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

jspack.ts

v1.0.9

Published

Library to pack/unpack binary data

Readme

JsPack is a library for working with binary data in JavaScript using the Uint8Array object. To ensure maximum stability, this library has 100% test coverage. The library was created using typescript for more convenient work with many types.


Installation

Install with npm:

npm i jspack.ts

Formats

Superscripts:

1: Unpack with 'f' and 'd' key can return NaN. The value NAN is used to represent a value that is an error. This is represented when exponent field is all ones with a zero sign bit or a mantissa that it not 1 followed by zeros. This is a special value that might be used to denote a variable that doesn’t yet hold a value.

Endianness

| Key | Description | |-----|----------------------| | < | Little endian | | > | Big endian | | ! | Network (big endian) |

Initialization

ES6:

import { JSPack, JSPackFormat, JSPackEndianness } from 'jspack.ts';

Node:

const { JSPack, JSPackFormat, JSPackEndianness } = require('jspack.ts');

Examples

Formats:


Char (ascii)

Pack:

// Return Uint8Array(97)
JSPack.Pack(JSPackFormat.c, 'a', JSPackEndianness.bigEndian);

Unpack:

// Return 'b'
JSPack.Unpack(JSPackFormat.c, new Uint8Array([98]), JSPackEndianness.bigEndian);

Int

Pack:

// Return Uint8Array(0x85)
JSPack.Pack(JSPackFormat.b, -123, JSPackEndianness.bigEndian);

Unpack:

// Return -123
JSPack.Unpack(JSPackFormat.b, new Uint8Array([0x85]), JSPackEndianness.bigEndian);

Int64 (long long int)

Pack:

// Return Uint8Array(0x00, 0x01, 0xEE, 0x0D, 0x32, 0xDE, 0xBC, 0xD1)
const longLongInt = {
    low: 0x32DEBCD1,
    high: 0x0001EE0D,
    unsigned: true,
};

JSPack.Pack(JSPackFormat.q, longLongInt, JSPackEndianness.bigEndian);

Unpack:

const longLongIntBinary = new Uint8Array([0x00, 0x01, 0xEE, 0x0D, 0x32, 0xDE, 0xBC, 0xD1]);

// Return { low: 0x32DEBCD1, high: 0x0001EE0D, unsigned: true }
JSPack.Unpack(JSPackFormat.q, longLongIntBinary, JSPackEndianness.bigEndian);

String (ASCII chars)

Pack:

// Return Uint8Array(97, 98, 99)
JSPack.Pack(JSPackFormat.s, 'abc', JSPackEndianness.bigEndian);

Unpack:

// Return 'abc'
JSPack.Unpack(JSPackFormat.s, new Uint8Array([97, 98, 99]), JSPackEndianness.bigEndian);

Array (Raw data)

Pack:

// Return Uint8Array(0x61, 0x62, 0x63)
JSPack.Pack(JSPackFormat.A, [97, 98, 99], JSPackEndianness.bigEndian);

Unpack:

// Return [97, 98, 99]
JSPack.Unpack(JSPackFormat.A, new Uint8Array([0x61, 0x62, 0x63]), JSPackEndianness.bigEndian);

IEEE 754 (Float, Double)

Pack:

// Return Uint8Array(0x47, 0x59, 0x3, 0x55)
JSPack.Pack(JSPackFormat.f, 55555.333, JSPackEndianness.bigEndian);

Unpack:

// Return 55555.33203125
JSPack.Unpack(JSPackFormat.f, new Uint8Array([0x47, 0x59, 0x3, 0x55]), JSPackEndianness.bigEndian);

Null Byte

Pack:

// Return Uint8Array(0)
JSPack.Pack(JSPackFormat.x, 0x0, JSPackEndianness.bigEndian);

Unpack:

// Return 0
JSPack.Unpack(JSPackFormat.x, new Uint8Array([0]), JSPackEndianness.bigEndian);