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

@frostbyte-os/react-native-escpos

v1.0.3

Published

react native network adapter for escpos

Readme

@frostbyte-os/react-native-escpos

React Native network adapter for ESC/POS receipt printers. Opens a raw TCP socket to a network printer and writes ESC/POS byte sequences to it.

Node's net module does not exist in React Native, so this wraps react-native-tcp-socket behind the same adapter shape the escpos ecosystem expects.

Install

npm install @frostbyte-os/react-native-escpos react-native-tcp-socket

react-native-tcp-socket is a peer dependency, so you install it yourself. Follow its own setup steps for the native side, including the Android INTERNET permission and a pod install for iOS.

Usage

import Network from "@frostbyte-os/react-native-escpos";

const printer = new Network("192.168.1.50", 9100);

printer.open((err) => {
  if (err) {
    console.warn("printer unreachable", err);
    return;
  }

  // ESC @ = initialize, then text, then GS V 0 = full cut
  printer.write(Buffer.from([0x1b, 0x40]));
  printer.write(Buffer.from("Hello world\n", "ascii"));
  printer.write(Buffer.from([0x1d, 0x56, 0x00]), () => {
    printer.close();
  });
});

Most network receipt printers listen on TCP 9100, which is the default when you omit the port.

API

new Network(address, [port])

Creates an adapter. port defaults to 9100. Does not connect; call open() for that.

.open(callback, [params])

Opens the socket. callback(err, device) fires on connect, and again with an error if the socket errors. params.onSocketKill(device) is invoked when the socket errors out.

.write(data, [callback])

Writes bytes to the printer. data is a Buffer, Uint8Array, or string. callback fires once the bytes are flushed.

.read(callback)

Subscribes to inbound data, callback(buffer) per chunk. Useful for real-time status back from printers that support it.

.close([callback])

Destroys the socket and emits disconnect. callback(null, device) fires afterward.

Events

Network extends EventEmitter and emits disconnect when close() runs.

Known issues

isConnected is defined both as an instance boolean and as a prototype method, and the boolean wins. Read it as a property (printer.isConnected) rather than calling it, since printer.isConnected() throws.

License

MIT