A small library wrapper for the rcon protocol made for FiveM
NPM-Package via
$ npm i https://github.com/DerDevHD/fivem-rcon
I don't know who the frick came to the idea, to invent such a nice rcon-protocol. You can basicly find zero documentations about this.
Thank you FiveM.
Example case: A small implemenation for a command-line RCON application.
import Rcon from 'fivem-rcon'
import process from 'process'
// first: host, second: port, third: password
const rcon = new Rcon('localhost', 30120, '1234')
const stdin = process.openStdin()
stdin.resume()
stdin.on('data', (data) => {
rcon.command(data).then(res => {
console.log(res.get())
}).catch(err => {
console.warn(err)
})
})
You see, pretty simple. Just one important method, command
, and one Promise. Nothing difficult.
You can specific a custom timeout through
rcon.timeout = 5000 // sets the [sending] timeout to 5 seconds