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

@jsprismarine/jsbinaryutils

v6.0.1

Published

Basic binary data managing tool written in TypeScript.

Readme

npm Dependents (via libraries.io) npm Documentation

JSBinaryUtils

A high-performance TypeScript library for binary data manipulation in Node.js applications. JSBinaryUtils provides efficient buffer management without the overhead of repeated allocations, making it ideal for real-time applications and network protocols.

Features

  • Zero-copy operations - Optimized buffer management with automatic capacity growth
  • Comprehensive API - Read/write support for all standard binary data types
  • Variable-length encoding - Built-in VarInt and VarLong support
  • Endianness control - Big-endian and little-endian operations
  • Type-safe - Full TypeScript support with type definitions
  • Well-tested - Extensive test coverage

Installation

npm install @jsprismarine/jsbinaryutils

Quick Start

Reading Binary Data

import BinaryStream from '@jsprismarine/jsbinaryutils';

const buffer = Buffer.from([0xFF, 0x00, 0x7F, 0x80]);
const stream = new BinaryStream(buffer);

const byte = stream.readByte();           // 255
const signed = stream.readSignedByte();   // 0
const short = stream.readShort();         // 32640

Writing Binary Data

import BinaryStream from '@jsprismarine/jsbinaryutils';

const stream = new BinaryStream();

stream.writeByte(255);
stream.writeShort(32640);
stream.writeVarInt(12345);

const result = stream.getWriteBuffer();

API Overview

Byte Operations

  • readByte() / writeByte(v) - Unsigned byte (0-255)
  • readSignedByte() / writeSignedByte(v) - Signed byte (-128 to 127)
  • readBoolean() / writeBoolean(v) - Boolean value

Integer Operations

  • readShort() / writeShort(v) - 16-bit signed integer (BE)
  • readShortLE() / writeShortLE(v) - 16-bit signed integer (LE)
  • readUnsignedShort() / writeUnsignedShort(v) - 16-bit unsigned integer (BE)
  • readInt() / writeInt(v) - 32-bit signed integer (BE)
  • readUnsignedInt() / writeUnsignedInt(v) - 32-bit unsigned integer (BE)

Triad Operations (24-bit)

  • readTriad() / writeTriad(v) - 24-bit signed integer (BE)
  • readTriadLE() / writeTriadLE(v) - 24-bit signed integer (LE)
  • readUnsignedTriad() / writeUnsignedTriad(v) - 24-bit unsigned integer (BE)

Floating Point Operations

  • readFloat() / writeFloat(v) - 32-bit float (BE)
  • readFloatLE() / writeFloatLE(v) - 32-bit float (LE)
  • readDouble() / writeDouble(v) - 64-bit double (BE)
  • readDoubleLE() / writeDoubleLE(v) - 64-bit double (LE)

Long Operations (64-bit)

  • readLong() / writeLong(v) - 64-bit signed BigInt (BE)
  • readLongLE() / writeLongLE(v) - 64-bit signed BigInt (LE)
  • readUnsignedLong() / writeUnsignedLong(v) - 64-bit unsigned BigInt (BE)

Variable-Length Operations

  • readVarInt() / writeVarInt(v) - 32-bit zigzag-encoded VarInt
  • readUnsignedVarInt() / writeUnsignedVarInt(v) - 32-bit unsigned VarInt
  • readVarLong() / writeVarLong(v) - 64-bit zigzag-encoded VarLong
  • readUnsignedVarLong() / writeUnsignedVarLong(v) - 64-bit unsigned VarLong

Buffer Operations

  • read(length) - Read raw bytes
  • write(buffer) - Write raw bytes
  • skip(length) - Skip bytes
  • readRemaining() - Read all remaining bytes
  • getReadBuffer() / getWriteBuffer() - Get underlying buffers

Stream Management

  • setReadBuffer(buffer, index?) - Set read buffer
  • setWriteBuffer(buffer, index?) - Set write buffer
  • getReadIndex() / setReadIndex(index) - Manage read position
  • getWriteIndex() / setWriteIndex(index) - Manage write position
  • clear() - Reset stream
  • reuse(buffer) - Reuse stream with new buffer
  • feof() - Check end of buffer

Documentation

Full API documentation with detailed method descriptions and examples is available at: https://jsprismarine.github.io/JSBinaryUtils/

Performance

JSBinaryUtils uses a dynamic buffer allocation strategy that minimizes memory overhead:

  • Initial allocation: 256 bytes or required size
  • Growth strategy: 2x current capacity when needed
  • No intermediate allocations during writes

This approach significantly outperforms naive Buffer.concat() operations in high-throughput scenarios.

License

ISC

Contributing

Contributions are welcome. Please open an issue or submit a pull request on GitHub.