A strictly-typed TypeScript port of python-escpos for ESC/POS thermal receipt printers.
This library was converted from python-escpos as part of a new POS project, targeting an offline-first Node.js/Electron environment.
MagicEncodeany — full TypeDoc API documentationnpm install escpos-ts
import { Network, QR_ECLEVEL_M } from 'escpos-ts';
const printer = new Network({ host: '192.168.1.100', port: 9100 });
await printer.open();
printer.hw('INIT');
printer.setWithDefault({ bold: true, align: 'center' });
printer.textln('My Shop');
printer.setWithDefault();
printer.textln('Ref: Invoice #INV-10042');
printer.barcode('012345678905', 'EAN13');
await printer.qr('https://myshop.com', { ec: QR_ECLEVEL_M });
printer.cut();
await printer.close();
| Class | Transport | Notes |
|---|---|---|
Network |
TCP/IP (net.Socket) |
Most common for POS setups |
Usb |
USB bulk transfer (usb / libusb) |
Requires udev rules on Linux |
Dummy |
In-memory buffer | Useful for testing |
import { ProfileManager } from 'escpos-ts';
const profiles = ProfileManager.listProfiles();
const profile = ProfileManager.getProfile('TM-T88V');
const printer = new Network({ host: '192.168.1.100', profileName: 'TM-T88V' });
Ported from python-escpos.