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

fast-bigint

v1.4.0

Published

Module for fast operations with long integers.

Downloads

8

Readme

fast-bigint

Module for fast operations with long integers.

Arithmetic operations are written in C.

Usage

const FastBigInt = require('fast-bigint');

// Create using number
const a = new FastBigInt(123);

// Create using little-endian buffer
const b = new FastBigInt(Buffer.from([0xff, 0xee, 0xff]));

// Add using 'add(a, b)'
const x = FastBigInt.add(a, b);
// Subtract using 'sub(a, b)'
const x = FastBigInt.sub(a, b);
// Multiply using 'mul(a, b)'
const x = FastBigInt.mul(a, b);
// Divide using 'div(a, b)'
const x = FastBigInt.div(a, b);
// Modulo using 'mod(a, b)'
const x = FastBigInt.mod(a, b);


// Set thread limit for async functions (default 8)
FastBigInt.setMaxThreads(8);

// Run async on new thread
const x = await FastBigInt.addAsync(a, b);
const x = await FastBigInt.subAsync(a, b);
const x = await FastBigInt.mulAsync(a, b);
const x = await FastBigInt.divAsync(a, b);
const x = await FastBigInt.modAsync(a, b);

FastBigInt.addAsync(a, b, (x) => {
    // Callback
});
FastBigInt.subAsync(a, b, (x) => {
    // Callback
});
FastBigInt.mulAsync(a, b, (x) => {
    // Callback
});
FastBigInt.divAsync(a, b, (x) => {
    // Callback
});
FastBigInt.modAsync(a, b, (x) => {
    // Callback
});

//Get little-endian buffer
//Buffer size is padded to multiple of 8
const x = new FastBigInt(8);
x.getBuffer() // = <Buffer 08 00 00 00 00 00 00 00>

//Compare using compare(a, b)
//returns
// -1 if a < b
// 0 if a = b
// 1 if a > b
FastBigInt.compare(
    new FastBigInt(10),
    new FastBigInt(15)
); // = -1

//Compare using compare functions
new FastBigInt(5).isGreaterOrEqual(new FastBigInt(4)); // = true

Warning

This module only supports positive numbers, so sub(a, b) when a < b will return invalid values

Performance

It's currently faster than JavaScript BigInt

  • When adding or subtracting numbers larger than ~98304 bytes
  • When multiplying numbers larger than ~12288 bytes

Division and modulo are now slower than JS BigInt, I will try to improve the algorithm in the future

You can perform calculations on multiple threads with async functions (unlike JavaScript, which is single-threaded)