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

@webbuf/numbers

v3.5.0

Published

Fixed-sized numbers (unsigned, signed, float) optimized with Rust/WASM for the web, node.js, deno, and bun.

Readme

@webbuf/numbers

Fixed-size unsigned integers with big-endian and little-endian support.

Installation

npm install @webbuf/numbers

Usage

import {
  U8,
  U16BE,
  U16LE,
  U32BE,
  U32LE,
  U64BE,
  U64LE,
  U128BE,
  U128LE,
  U256BE,
  U256LE,
} from "@webbuf/numbers";

// Create from number or bigint
const a = U32BE.fromN(1000);
const b = U64BE.fromBn(0x123456789abcdef0n);

// Arithmetic
const sum = a.add(U32BE.fromN(500));
const diff = a.sub(U32BE.fromN(100));
const product = a.mul(U32BE.fromN(2));
const quotient = a.div(U32BE.fromN(10));

// Convert to number/bigint
a.n; // 1000 (number)
a.bn; // 1000n (bigint)

// Buffer conversions
const beBuf = a.toBEBuf(); // Big-endian FixedBuf
const leBuf = a.toLEBuf(); // Little-endian FixedBuf
const restored = U32BE.fromBEBuf(beBuf);

// Hex conversions
const hex = a.toHex(); // "000003e8"
const fromHex = U32BE.fromHex("000003e8");

Types

| Type | Size | Range | | ------------------ | -------- | ------------------ | | U8 | 1 byte | 0 to 255 | | U16BE, U16LE | 2 bytes | 0 to 65,535 | | U32BE, U32LE | 4 bytes | 0 to 4,294,967,295 | | U64BE, U64LE | 8 bytes | 0 to 2^64-1 | | U128BE, U128LE | 16 bytes | 0 to 2^128-1 | | U256BE, U256LE | 32 bytes | 0 to 2^256-1 |

BE = Big Endian, LE = Little Endian

API

Static Methods

| Method | Description | | ---------------- | -------------------------------- | | fromN(n) | Create from number | | fromBn(bn) | Create from bigint | | fromBEBuf(buf) | Create from big-endian buffer | | fromLEBuf(buf) | Create from little-endian buffer | | fromHex(hex) | Create from hex string |

Instance Properties/Methods

| Property/Method | Description | | --------------- | ------------------------------- | | n | Get value as number | | bn | Get value as bigint | | add(other) | Add | | sub(other) | Subtract | | mul(other) | Multiply | | div(other) | Divide | | toBEBuf() | Convert to big-endian buffer | | toLEBuf() | Convert to little-endian buffer | | toHex() | Convert to hex string |

License

MIT