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

esc-pos-proxy-capacitor-plugin

v0.0.7

Published

-

Readme

esc-pos-proxy-capacitor-plugin

PRINTER-STUFF

npm version

A Capacitor 8 plugin for talking to network-attached ESC/POS thermal printers over raw TCP. It can:

  • Print — dispatch raw ESC/POS byte sequences to a printer (default port 9100)
  • Ping — check whether a printer is reachable and measure round-trip time
  • Discover — find printers on the local network via mDNS (_printer._tcp, _pdl-datastream._tcp) plus a subnet scan on common raw-print ports (9100/9101/9102)

Native implementations are provided for Android and iOS. The web implementation is a no-op — browsers can't open raw TCP sockets to a printer.

Install

npm install esc-pos-proxy-capacitor-plugin
npx cap sync

Usage

import { ESCPOSProxy } from 'esc-pos-proxy-capacitor-plugin';

// Raw ESC/POS bytes (init + "Hello" + line feed + cut), base64-encoded
const bytes = new Uint8Array([0x1b, 0x40, 0x48, 0x65, 0x6c, 0x6c, 0x6f, 0x0a, 0x1d, 0x56, 0x00]);
const message = btoa(String.fromCharCode(...bytes));
await ESCPOSProxy.print({ ip: '192.168.1.50', port: 9100, message });

// Check if a printer is reachable
const { online, rtt } = await ESCPOSProxy.ping({ ip: '192.168.1.50', port: 9100 });

// Find printers on the local network
const { printers } = await ESCPOSProxy.discover({ timeout: 10000 });
// → [{ ip: '192.168.1.50', port: 9100, source: 'mdns' | 'scan' }, ...]

API

print(...)

print(options: { message: string; ip: string; port: number; }) => Promise<{ status: string; }>

Send raw ESC/POS bytes to a network printer at the given IP/port.

message must be a base64-encoded string. Callers that already hold a Uint8Array should encode it with btoa(String.fromCharCode(...bytes)) or an equivalent helper before passing it in. Rejects with a descriptive error if the socket fails to connect or write.

| Param | Type | | ------------- | ----------------------------------------------------------- | | options | { message: string; ip: string; port: number; } |

Returns: Promise<{ status: string; }>


ping(...)

ping(options: { ip: string; port?: number; }) => Promise<{ online: boolean; rtt?: number; }>

Check whether a printer is reachable on the given IP/port.

| Param | Type | | ------------- | ------------------------------------------- | | options | { ip: string; port?: number; } |

Returns: Promise<{ online: boolean; rtt?: number; }>


discover(...)

discover(options?: { ports?: number[] | undefined; timeout?: number | undefined; } | undefined) => Promise<{ printers: PrinterDescriptor[]; }>

Discover ESC/POS-ready printers on the local network. Ports default to common raw printing ports (9100/9101/9102). Timeout is the maximum scan duration in milliseconds.

| Param | Type | | ------------- | ---------------------------------------------------- | | options | { ports?: number[]; timeout?: number; } |

Returns: Promise<{ printers: PrinterDescriptor[]; }>


Interfaces

PrinterDescriptor

| Prop | Type | | ------------ | ----------------------------- | | ip | string | | port | number | | source | 'scan' | 'mdns' |