PortablePosPrinterHamekara/node_modules/@node-escpos/network-adapter/dist/index.d.ts

40 lines
1.1 KiB
TypeScript

import net from 'net';
import { Adapter } from '@node-escpos/adapter';
/**
* Network Adapter
*/
declare class Network extends Adapter<[device: net.Socket]> {
private readonly address;
private readonly port;
private readonly timeout;
private readonly device;
/**
* @param {[type]} address
* @param {[type]} port
*/
constructor(address: string, port?: number, timeout?: number);
/**
* connect to remote device
* @praram {[type]} callback
* @return
*/
open(callback?: (error: Error | null, device: net.Socket) => void): this;
/**
* write data to printer
* @param {[type]} data -- byte data
* @param {Function} callback
* @return
*/
write(data: string | Buffer, callback?: (error: Error | null) => void): this;
read(callback?: (data: Buffer) => void): this;
/**
* [close description]
* @param {Function} callback [description]
* @return {[type]} [description]
*/
close(callback?: (error: Error | null, device: net.Socket) => void): this;
}
export { Network as default };