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

sumni-utils

v2.0.1

Published

A collection of hardware utilities for SUMNI devices.

Readme

sumni-utils

Printer Class Documentation

The Printer class provides a set of utility methods to interact with a printing device. It allows for printing text, columns, QR codes, and remote images, as well as setting alignment styles. The CashDrawer class provides some utilities for using the Sumni Models Cash Drawers.

Before using any of those classes you must first execute the initialize module.


Methods

print

Description: Prints a string with an optional style.

Syntax:

Printer.print(content: string, style?: PrinterStyle): Promise<void>

Parameters:

  • content (string): The text to print.
  • style (PrinterStyle, optional): The style to apply to the text.

Returns:

  • A promise that resolves when the printing is complete.

printColumns

Description: Prints multiple columns with specified text, widths, and styles.

Syntax:

Printer.printColumns(columns: { text: string; width: number; style?: PrinterStyleColumns; }[]): Promise<void>

Parameters:

  • columns (array): An array of objects, each containing:
    • text (string): The text for the column.
    • width (number): The width of the column.
    • style (PrinterStyleColumns, optional): The style for the column.

Returns:

  • A promise that resolves when the columns are printed.

Errors:

  • Throws an error if columns is not an array of valid objects.

setAlignment

Description: Sets the alignment for the printer.

Syntax:

Printer.setAlignment(align: Alignment): Promise<void>

Parameters:

  • align (Alignment): The desired alignment (e.g., left, center, right).

Returns:

  • A promise that resolves when the alignment is set.

Errors:

  • Throws an error for invalid alignment values.

printQRCode

Description: Prints a QR code with specified data, alignment, size, and error correction level.

Syntax:

Printer.printQRCode({ data, align, size, ecc }: { data: string; align?: Alignment; size?: number; ecc?: 'L' | 'M' | 'Q' | 'H'; }): Promise<void>

Parameters:

  • data (string): The data to encode in the QR code.
  • align (Alignment, optional): The alignment of the QR code (default: center).
  • size (number, optional): The size of the QR code (range: 4-16, default: 12).
  • ecc (string, optional): The error correction level (L, M, Q, or H, default: M).

Returns:

  • A promise that resolves when the QR code is printed.

Errors:

  • Throws an error for invalid data, size, alignment, or ECC values.

printRemoteImage

Description: Fetches and prints an image from a remote URL with optional alignment and dimensions.

Syntax:

Printer.printRemoteImage({ url, requestConfig, align, width, height }: { url: string; requestConfig?: RequestInit; align?: Alignment; width?: number | null; height?: number | null; }): Promise<void>

Parameters:

  • url (string): The URL of the image.
  • requestConfig (RequestInit, optional): Configuration for the HTTP request.
  • align (Alignment, optional): The alignment of the image (default: center).
  • width (number | null, optional): The desired width of the image.
  • height (number | null, optional): The desired height of the image.

Returns:

  • A promise that resolves when the image is printed.

Errors:

  • Throws an error for failed image requests, invalid content types, or alignment issues.

Types

PrinterStyle

An object defining text styling options (implementation-specific).

PrinterStyleColumns

An object defining column-specific styling options.

Alignment

A string indicating alignment options (e.g., left, center, right).

ECC

An array containing valid error correction levels for QR codes (L, M, Q, H).


CashDrawer Methods

open

Description: Opens the cash drawer.

Syntax:

CashDrawer.open(): Promise<void>

Parameters:

  • None.

Returns:

  • A promise that resolves when the cash drawer is successfully opened.

isOpen

Description: Checks if the cash drawer is open.

Syntax:

CashDrawer.isOpen(): Promise<boolean>

Parameters:

  • None.

Returns:

  • A promise that resolves to true if the cash drawer is open, or false otherwise.