npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@capvision/printer-pos

v1.3.0

Published

Library that offers easy API to communicate with point-of-sales printers, by serial way (usb), TCP/IP (wifi) and bluetooth.

Readme

Node POS

Library that offers easy API to communicate with point-of-sales printers, by serial way (usb), TCP/IP (wifi) and bluetooth.

Usage

import { AbstractAdapter, SerialAdapter, TcpAdapter, USBAdapter, listPrinters, Printer } from "@capvision/printer-pos";

const printers = await listPrinters();
const selectedPrinter = printers[0];

let adapter: AbstractAdapter;

if(selectedPrinter.type === "USB") {
    adapter = new USBAdapter({
        vendorId: selectedPrinter.vendorId,
        productId: selectedPrinter.productId,
    });
}
else if(selectedPrinter.type === "Network") {
    adapter = new TcpAdapter({
        host: selectedPrinter.host,
        port: selectedPrinter.port, // optional, defaults to 9100
    });
}
else {
    adapter = new SerialAdapter({
        path: selectedPrinter.path,
    });
}
// or directly adapter = new *Adapter(selectedPrinter);

const printer = new Printer(adapter);

await printer.open();

printer.setDefaultStyle({
    align: "left",
    bold: false,
    underline: false,
    double: false,
    font: "a",
});

await printer
    .text("=== Printing Test ===\n", { bold: true, underline: true })
    .text("Hello, this is a printing test.\n", { align: "center" })
    .text("We thank you for using our POS solution !\n\n", { font: "b" })
    .cut()
    .flush();

await printer.close();

Even easier :

import { AdapterFactory, listPrinters, Printer } from "@capvision/printer-pos";

const printers = await listPrinters();
const selectedPrinter = printers[0];
const adapter = AdapterFactory.create(selectedPrinter);
const printer = new Printer(adapter);

Network (TCP/IP) configuration

Ethernet / Wi-Fi printers are driven over a RAW ESC/POS socket — the de-facto standard "port 9100" transport (a.k.a. Epson RAW / JetDirect). Provide the host and, optionally, the port (default 9100):

const adapter = new TcpAdapter({ host: "192.168.1.50", port: 9100 });

AdapterFactory.create(printerInfo) builds a TcpAdapter when printerInfo.type === "Network", forwarding printerInfo.host and printerInfo.port. Network printers are not auto-discovered by listPrinters() (they require an IP/host known to the operator); the host app is expected to let the user enter the host/port and store it on PrinterInfo.

Status read-back (DLE EOT) is best-effort: many network printers do not answer, in which case Printer.getStatus() resolves to null.

Text size

Character magnification uses GS ! n (ESC/POS), supporting independent width/height multipliers from to :

printer.text("TITLE", { widthScale: 2, heightScale: 2 }); // double size
printer.text("HUGE",  { widthScale: 3, heightScale: 4 }); // 3× wide, 4× tall

The legacy boolean double flag still works (equivalent to 2×2) but explicit widthScale/heightScale take precedence when set. To map a logical point size (e.g. coming from a layout) onto the discrete POS paliers, use fontSizeToScale(fontSize, baseFontSize?) (baseline POS_BASE_FONT_SIZE = 10pt → 1×).

Serial configuration

Serial / Bluetooth printers default to 9600 8N1. Override (and persist) the link parameters per printer:

const adapter = new SerialAdapter({ path: "COM5", baudRate: 19200, parity: "even" });

AdapterFactory.create(printerInfo) forwards printerInfo.serial to the adapter, so storing a known-good configuration on PrinterInfo.serial avoids re-discovering it on every print.

Best-effort auto-detection (for printers that answer DLE EOT):

import { detectPrinterSerialConfig } from "@capvision/printer-pos";
const params = await detectPrinterSerialConfig("COM5"); // SerialParams | null

Text is encoded with the printer's code page (default cp1252, covering French accents and the € sign); change it via new Printer(adapter, { codePage: "cp858" }).

Notes

USB devices can work with Serial Port, or native USB.

Bluetooth devices almost always work Serial Port.