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

@cutos/device-receipt-printer

v4.1.0

Published

CUTOS 4.0 Receipt Printer Capability SDK

Readme

@cutos/device-receipt-printer

CUTOS 4.0 Receipt Printer Capability SDK.

  • Package: @cutos/device-receipt-printer
  • Version: 4.1.0
  • Capability: capability.device.receipt-printer
  • Runtime dependency: @cutos/core >= 4.0.8

The SDK defines vendor-neutral receipt-printing operations. Hardware access and vendor DLLs belong to a concrete Provider and are not included in this package.

Install

npm install @cutos/core @cutos/device-receipt-printer

Quick start

import { CoreAPI } from "@cutos/core"
import { DeviceCapabilityReceiptPrinter } from "@cutos/device-receipt-printer"

await CoreAPI.init("localhost")

const printer = new DeviceCapabilityReceiptPrinter()
await printer.init()

printer.onData(event => console.log("data", event))
printer.onStatus(status => console.log("status", status))
printer.onError(error => console.error("error", error))

await printer.connect()

console.log(await printer.readDeviceInfo())
console.log(await printer.getStatus())

await printer.printText({
  text: "Hello CUTOS",
  alignment: "center",
  width: 2,
  height: 2,
  bold: true
})
await printer.feed({ dots: 240 })
await printer.backFeed({ dots: 40 })

await printer.printQrCode({
  content: "https://www.cut-os.com",
  size: 6,
  leftMargin: 0
})
await printer.feed({ dots: 240 })

await printer.cut({ mode: "partial" })
await printer.disconnect()

Connection

The default connection and supported transports are Provider-specific.

await printer.connect() // use Provider defaults
await printer.connect({ connection: "usb" }) // USB auto detection
await printer.connect({ connection: "usb", port: "USB001" })
await printer.connect({ connection: "serial", port: "COM1", baudRate: 115200 })

Supported baud rates are 9600, 38400, and 115200.

Printing

printText(params)

await printer.printText({
  text: "Receipt line",
  alignment: "left", // left | center | right
  width: 1,           // 1-8
  height: 1,          // 1-8
  bold: false,
  lineFeed: true
})

Formatting belongs to this operation and is not shared as mutable SDK state. The result is { success: true } when the Provider accepts the operation.

printQrCode(params)

await printer.printQrCode({
  content: "https://www.cut-os.com",
  size: 6,       // 1-8
  leftMargin: 0  // 0-27 mm
})

feed(params)

await printer.feed({ dots: 240 })

dots ranges from 0 to 250. On the MS-MA90 Provider one dot is 0.125 mm, so 240 dots advances approximately 30 mm.

Printing text or a QR code does not implicitly advance paper to the outlet. Call feed() explicitly when the application needs additional paper movement.

backFeed(params)

await printer.backFeed({ dots: 40 })

Reverse-feeds paper by 0 to 250 dots. This operation requires a Provider and printer that support reverse paper movement. The MS-MA90 Provider maps it to the vendor SDK's PrintBackDot() function. Start with a small value such as 40 dots when testing hardware.

cut(params)

await printer.cut({ mode: "partial" }) // partial | full

getStatus()

Returns:

{
  code: number
  state: "ready" | "offline" | "head-open" | "cutter-error" |
    "temperature-error" | "blackmark-error" | "paper-out" |
    "paper-low" | "unknown"
  ready: boolean
  message: string
}

Base Device API

DeviceCapabilityReceiptPrinter inherits the standard Device Capability methods:

  • init()
  • connect()
  • disconnect()
  • readDeviceInfo()
  • onData(listener)
  • onStatus(listener)
  • onError(listener)
  • dispose()

Keep the unsubscribe function returned by each event method and call dispose() when the LWA no longer uses the device.