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

@maxxuxx/node-printer

v1.5.0

Published

Unified entry point for ESC/POS receipt printer transports (serial, network, CUPS, Windows Spooler)

Readme

@maxxuxx/node-printer

한국어

Unified ESC/POS receipt printer API for Node.js and Electron

This package provides one entry point for serial, network, CUPS, and Windows Spooler printers

Transport packages are lazy-loaded so importing the package does not immediately load platform-specific native modules

Tech Stack

| Area | Stack | | -------------- | -------------------------------------- | | Runtime | Node.js 20+ | | Language | TypeScript | | Module output | ESM and CommonJS | | Receipt output | ESC/POS bytes | | Transports | Network, Serial, CUPS, Windows Spooler | | Native loading | Lazy import with bundled prebuilds |

Install

npm install @maxxuxx/node-printer

Runtime Support

| Runtime | Status | Notes | | ------------------------------- | --------------- | ------------------------------------------ | | Node.js CLI | ✅ Supported | Node.js 20 or later | | Electron main process | ✅ Supported | Native addons load from the main process | | Electron run-as-node worker | ✅ Supported | Windows winspool prebuilds support this from 1.3.1 | | Electron renderer direct import | ❌ Not recommended | Use preload or main IPC instead | | Browser runtime | ❌ Not supported | Native .node addons cannot load there | | Bun or Deno | ⚠️ Not guaranteed | Depends on .node addon compatibility | | Android Node runtime | ⚠️ Experimental | Prebuilds are included, permissions vary |

What Works

| Feature | Status | Notes | | ----------------------------- | ------------ | ------------------------------------------- | | Network TCP 9100 | ✅ Available | Works on Node runtimes with TCP socket access | | Serial COM or tty | ✅ Available | Works on Windows, macOS, Linux, and Android prebuild targets | | CUPS printing | ✅ Available | Works on macOS and Linux | | Windows Spooler RAW | ✅ Available | Works on Windows with bundled prebuilds | | Winspool on non-Windows | ❌ Not used | Throws ERR_UNSUPPORTED_PLATFORM | | npm source build fallback | ❌ Not used | Published installs expect bundled prebuilds |

Quick Start

import { createReceipt, print } from "@maxxuxx/node-printer";

const receipt = createReceipt({ encoding: "cp949" })
  .initialize()
  .text("테스트 출력")
  .divider()
  .text("NETWORK OK")
  .feed(3)
  .cut()
  .encode();

await print({
  type: "network",
  host: "192.168.0.50",
  port: 9100
}, receipt);

Choose a Printer

Network

await print({
  type: "network",
  host: "192.168.0.50",
  port: 9100,
  timeoutMs: 5000,
  retry: {
    retries: 2,
    minDelayMs: 100,
    maxDelayMs: 1000,
    factor: 2
  }
}, receipt);

Serial

await print({
  type: "serial",
  path: "COM3",
  baudRate: 9600
}, receipt);

CUPS

await print({
  type: "cups",
  printerName: "Receipt",
  documentName: "Receipt"
}, receipt);

Windows Spooler

await print({
  type: "winspool",
  printerName: "Receipt",
  documentName: "Receipt"
}, receipt);

Winspool is available only on Windows

The native binding uses bundled prebuilds and does not compile during npm install

Receipt Builder

const receipt = createReceipt({ columns: 42, encoding: "cp949" })
  .initialize()
  .align("center")
  .bold()
  .text("STORE NAME")
  .bold(false)
  .divider()
  .row([
    { text: "Americano", width: 32 },
    { text: "4,500", width: 16, align: "right" }
  ])
  .qr("https://github.com/maxxuxx/node-printer")
  .feed(3)
  .cut()
  .encode();

Supported builder commands include text, rows, alignment, bold, underline, size, feed, cut, QR, barcode, image, and raw bytes

Platform Support

| Platform | Network | Serial | CUPS | Winspool | | ----------------- | ----------------- | ---------------------- | ------------ | ------------ | | Windows ia32 | ✅ Supported | ✅ Supported | ❌ No | ✅ Supported | | Windows x64 | ✅ Supported | ✅ Supported | ❌ No | ✅ Supported | | Windows arm64 | ✅ Supported | ✅ Supported | ❌ No | ✅ Supported | | macOS x64/arm64 | ✅ Supported | ✅ Supported | ✅ Supported | ❌ No | | Linux x64/arm64 | ✅ Supported | ✅ Supported | ✅ Supported | ❌ No | | Android arm/arm64 | ⚠️ Runtime dependent | ⚠️ Experimental prebuilds | ❌ No | ❌ No |

Calling a winspool target on a non-Windows platform throws ERR_UNSUPPORTED_PLATFORM

Android serial arm and arm64 prebuilds are included, but Android runtime support is experimental because serial device access depends on the host Node environment and OS permissions

List Printers

import { listPrinters } from "@maxxuxx/node-printer";

const serialPorts = await listPrinters("serial");
const usbPrinters = await listPrinters("usb");
const networkPrinters = await listPrinters("network");

Prebuilds

Normal installs use bundled serial prebuilds on Windows, macOS, Linux, and Android arm or arm64

Normal installs use the bundled winspool prebuild when running on Windows

Starting with @maxxuxx/[email protected], Windows winspool prebuilds delay-load node.exe so the same N-API addon can load under Node.js and Electron runtimes

Direct native builds are available in the repository for maintainers and contributors who need to validate or refresh prebuild artifacts

| Path | Status | When to use | | --------------------------- | --------------- | ------------------------------------------- | | Bundled serial prebuild | ✅ Recommended | App installs and normal package usage | | Bundled winspool prebuild | ✅ Recommended | Windows spooler app installs | | Direct repository build | ✅ Available | Native validation and prebuild refresh work | | Source build during install | ❌ Not provided | Keeps npm installs predictable across OSes |

Errors

All package-level errors use PrinterError

import { PrinterError, isPrinterError } from "@maxxuxx/node-printer";

try {
  await printer.print(receipt);
} catch (error) {
  if (isPrinterError(error)) {
    console.error(error.code, error.retryable);
  }
}

Common error codes include ERR_INVALID_TARGET, ERR_UNSUPPORTED_PLATFORM, ERR_CONNECTION_TIMEOUT, ERR_WRITE_TIMEOUT, ERR_NATIVE_MODULE_UNAVAILABLE, and transport-specific failure codes

Contributors Welcome

Contributions are welcome for bug fixes, docs, platform checks, and printer validation notes

Repository

https://github.com/maxxuxx/node-printer

License

MIT