@fibercom/routeros-api
Version:
Robust MikroTik RouterOS API client for Node.js and TypeScript
31 lines (30 loc) • 948 B
TypeScript
import { Socket } from 'net';
/**
* Transmitter encodes RouterOS commands into properly framed buffers
* and writes them to a socket. If the socket is not ready, it queues
* the commands to be sent later.
*/
export declare class Transmitter {
private socket;
private pool;
constructor(socket: Socket);
/**
* Sends a command line. If the socket isn't writable or if a backlog exists,
* it queues the command instead.
*
* @param {string} data - Command or null to terminate a command group.
*/
write(data: string): void;
/**
* Sends all previously queued commands once the socket is ready.
*/
runPool(): void;
/**
* Encodes a string into RouterOS framed protocol using win1252.
* Adds appropriate length prefix for each frame.
*
* @param {string|null} str
* @returns {string} Encoded frame to be sent over the socket.
*/
private encodeString;
}