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

@posara/printer-agent

v0.5.0

Published

POSARA Horizon print agent — one command to print receipts, invoices and labels on this computer's printers

Downloads

1,931

Readme

@posara/printer-agent

Prints POSARA Horizon receipts, invoices and labels (ESC/POS, ZPL, TSPL, text) on the printers attached to this computer.

npx @posara/printer-agent --token <TOKEN> --url https://posara-horizon-t1.dcn01.ctdn.dev --install

Create the token in Printer Management → Agents (it is shown once, with this command pre-filled). Requires Node.js 20+. Windows, macOS and Linux.

--install registers a background service that starts automatically and restarts on failure. Without it the agent runs in the foreground.

| | Service | Starts | |---|---|---| | Windows | A real Windows service (PosaraPrinterAgent, run by WinSW) | At boot, no login needed | | macOS | launchd agent | At login | | Linux | systemd user service | At boot (needs loginctl enable-linger, done for you when permitted) |

Windows: installing needs administrator rights. Run the command from any terminal and approve the Windows prompt (or run it from an Administrator terminal). The agent's code goes to %ProgramData%\posara-printer-agent\service, which only administrators can change, because the service runs as SYSTEM; your config, queue and log stay in %LOCALAPPDATA%\posara-printer-agent. The service wrapper is downloaded once from its GitHub release and checked against a pinned hash (offline: download WinSW.NET461.exe and set POSARA_WINSW_PATH). An older scheduled-task install is replaced when you run install again. Printers installed only for your own Windows user are not visible to the service; install them for all users.

Commands

| | | |---|---| | run (default) | Run in the foreground | | install / uninstall | Add or remove the background service | | status | Service state and queue size | | logs | Recent log lines | | printers | Printers found on this computer | | test-print --printer <name> | Print a test page | | version / check-update | Show the installed version / check for a newer one | | update | Install the latest version and restart the service | | restart | Restart the background service |

update and restart need no administrator rights, even on Windows: when the service cannot be controlled directly they leave a request the running service acts on within seconds.

Updates

A service checks for a newer release when it starts and every hour, and installs it when its queue is empty (turn off with --no-auto-update). It downloads the package straight from the npm registry and checks its integrity hash (npm is only a fallback for networks that need its proxy settings), keeps the previous build, then exits so the service manager starts the new one: launchd and systemd restart on any exit, and the Windows service restarts on the agent's exit code 75. A new build that starts three times without staying healthy for 90 seconds is replaced by the previous one. Updating changes only the agent's code; reinstall (install) to change the service definition itself.

Options: --poll-only (HTTP polling instead of websocket), --insecure (allow http:// to a non-local server), or set POSARA_PRINTER_TOKEN / POSARA_URL. After the first run the settings are saved, so the service needs no flags.

Printer addresses

The printer name field takes more than an installed printer's name:

| Name | Goes to | |---|---| | EPSON_TM_T20 | the operating system's queue (CUPS raw / Windows spooler) | | tcp://192.168.1.50 or tcp://192.168.1.50:9100 | a LAN or Wi-Fi printer on its raw port (9100 by default); also network:host:port and tcp://[ipv6]:port | | usb://04b8:0e15 or usb://04b8:0e15/SERIAL | a USB printer straight through libusb, no OS queue needed |

printer-agent printers lists installed printers and the USB printers that are plugged in, with the address to use. Network sends retry twice and say why they failed (refused, unreachable, timed out).

USB uses the optional usb package (prebuilt libusb binaries; it installs with the agent). On Windows install the WinUSB driver for the printer with Zadig; on Linux add a udev rule for the printer (or run the agent as root); macOS needs nothing. The SERIAL part tells two printers of one model apart.

Text and encoding

Text jobs go out as UTF-8 by default. A job from the local endpoint can set encoding: "latin1" and codepage: n (sends ESC t n first) for printers on a single-byte code page. Raw ZPL/TSPL/ESC/POS bytes are never re-encoded: the browser sends them as base64, so UTF-8 labels and Latin-1 labels both arrive as written.

How it works

  • Transport: websocket (/printer), falling back to HTTP polling (/api/print-agent/claim) whenever the socket is down. Results are always confirmed over HTTP.
  • Queue: jobs are written to a local log before printing. If the printer is off or out of paper, the job is retried with exponential backoff (5 s → 5 min, 6 tries); later jobs for the same printer keep their order, other printers keep flowing. A crash or reboot resumes where it stopped.
  • Exactly once: a finished job's result is held until POSARA confirms it, and the server ignores duplicates, so an offline server never causes a reprint.
  • Printers: local queue names (CUPS on macOS/Linux, the Windows spooler), or tcp://host:9100 for a network printer. Leave the printer name empty for the system default.

Local endpoint (POS "Printer Agent" mode)

While running, the agent also listens on http://localhost:9191 (GET /api/health, GET /api/printers, POST /api/print) so the POS in a browser on the same computer can print directly: in POS → Print Settings choose Printer Agent and keep the URL http://localhost:9191. Change the port with --local-port, or turn it off with --no-local. Only the POSARA address you set up the agent with may call it from a browser; other websites are refused with a 403 that names the refused address. Pages served from this computer (http://localhost:3000, http://127.0.0.1:…) are always allowed. If you open POSARA from a different address (another domain), add it with --allow-origin https://that-address (repeatable; saved for next time). Chrome and Edge allow an https page to call localhost; Safari does not (use cloud printing there).

Security

  • Outbound connections, plus the local endpoint above, which listens on 127.0.0.1 only, checks the Host header (DNS rebinding) and refuses browser requests from any origin other than your POSARA address.
  • https:// is required (plain http:// only for localhost, or with --insecure). Redirects are never followed with the token attached.
  • The token is stored in the per-user data folder with 0600 permissions and is never logged. POSARA stores only its SHA-256 hash.
  • Tokens can be revoked (delete the agent in Printer Management) or given an expiry; a revoked token stops working immediately.
  • Print data is sent to the printer as raw bytes; printer names are passed as arguments, never through a shell.

Data folder: %LOCALAPPDATA%\posara-printer-agent, ~/Library/Application Support/posara-printer-agent, or ~/.local/state/posara-printer-agent.