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

@hdml/hooks

v0.0.2-alpha.11

Published

This module is part of the **HDML-Utilities** monorepo and provides a set of I/O utility functions for reading from stdin and writing to stdout. It's designed to work in environments like WebAssembly (Javy) where standard I/O operations require special ha

Readme

@hdml/hooks

This module is part of the HDML-Utilities monorepo and provides a set of I/O utility functions for reading from stdin and writing to stdout. It's designed to work in environments like WebAssembly (Javy) where standard I/O operations require special handling.

Features

This package provides the following I/O utility functions:

Reading Functions

  1. readUint8Array: Reads raw bytes from stdin and returns them as a Uint8Array.
  2. readString: Reads a string from stdin by decoding the input bytes using UTF-8 encoding.
  3. readJson: Reads and parses a JSON object from stdin.

Writing Functions

  1. writeUint8Array: Writes a Uint8Array to stdout and returns the number of bytes written.
  2. writeString: Writes a string to stdout by encoding it as UTF-8 and returns the number of bytes written.
  3. writeJson: Serializes a JSON object to a string and writes it to stdout, returning the number of bytes written.

Dependencies

This module depends on:

  • @hdml/parser: For parsing HDML documents
  • @hdml/schemas: FlatBuffers schema-based classes for serialization
  • @hdml/types: TypeScript interface definitions for HDML components

Installation

To install this module, simply add it to your project:

npm install @hdml/hooks

Usage

Reading from stdin

import { readString, readJson, readUint8Array } from "@hdml/hooks";

// Read a string from stdin
const text = readString();
console.log(text);

// Read and parse JSON from stdin
const data = readJson<{ name: string; age: number }>();
console.log(data.name, data.age);

// Read raw bytes from stdin
const bytes = readUint8Array();
console.log(bytes.length);

Writing to stdout

import { writeString, writeJson, writeUint8Array } from "@hdml/hooks";

// Write a string to stdout
const bytesWritten = writeString("Hello, world!");
console.log(`Wrote ${bytesWritten} bytes`);

// Write a JSON object to stdout
const bytesWritten = writeJson({ name: "John", age: 30 });
console.log(`Wrote ${bytesWritten} bytes`);

// Write raw bytes to stdout
const bytesWritten = writeUint8Array(new Uint8Array([1, 2, 3]));
console.log(`Wrote ${bytesWritten} bytes`);

Complete Example

import { readJson, writeJson } from "@hdml/hooks";

// Read JSON input from stdin
const input = readJson<{ message: string }>();

// Process the data
const output = {
  response: `Received: ${input.message}`,
  timestamp: Date.now(),
};

// Write JSON output to stdout
writeJson(output);

Notes

  • The functions use Javy.IO.readSync and Javy.IO.writeSync internally, making them suitable for WebAssembly environments like Javy.
  • readUint8Array reads input in 1024-byte chunks and assembles them into a single array.
  • All string operations use UTF-8 encoding/decoding.
  • JSON operations use JSON.parse and JSON.stringify for parsing and serialization.

License

Apache License Version 2.0