Registry / serialization / browserify-bignum

browserify-bignum

JSON →
library1.3.0-2jsnpmunverified

This library provides a JavaScript implementation of arbitrary-precision arithmetic, specifically designed to be compatible with Node.js's `node-bignum` API while being usable in browser environments via Browserify. It is based on `bignumber.js` by MikeMcl. The current stable version is 1.3.0-2, released approximately nine years ago. It differs from the original `node-bignum` by explicitly *omitting* several key methods, including `prime`, `toNumber`, bitwise operations (`and`, `or`, `xor`), modular inverse, random number generation, primality testing, root, shift operations, GCD, and Jacobi symbol. This makes it suitable only for specific use cases that do not require these advanced features, such as its original purpose for `node-srp`. Given its age and the explicit statement about unimplemented features, active development is not ongoing, and it targets older browserify workflows rather than modern ESM or bundler setups.

npm install browserify-bignum
INSTALL
IMPORT
SIG · BROWSERIFY-BIGNUM
B
browserify-bignum
serializationjavascriptv1.3.0-2
Install
Import
Disk
Pass rate
0/ 6
Env Coverage0 / 6
glibc
1822
musl
1822
Install & Compatibility
Where this runs
tested against v? · npm install
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
node 18226 runs
build_error
glibc
node 18226 runs
build_error
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BigNumber
const BigNumber = require('browserify-bignum');
import { BigNumber } from 'browserify-bignum';
Primarily designed for CommonJS (`require`) and Browserify. Does not provide native ESM exports.
BigNumber (instance)
const n = BigNumber('12345');
const n = new BigNumber('12345');
The library typically uses the constructor as a function (e.g., `BigNumber('...')`) rather than `new BigNumber(...)`, consistent with its `node-bignum` inspiration.

Demonstrates how to import the BigNumber constructor, create instances from strings, and perform basic arithmetic and comparison operations.

const BigNumber = require('browserify-bignum'); // Create a new BigNumber instance from a string const a = BigNumber('987654321098765432109876543210'); const b = BigNumber('123456789012345678901234567890'); // Perform some arithmetic operations const sum = a.add(b); const product = a.mul(b); const quotient = a.div(BigNumber('3')); // Divide by BigNumber '3' console.log('BigNumber a:', a.toString()); console.log('BigNumber b:', b.toString()); console.log('Sum (a + b):', sum.toString()); console.log('Product (a * b):', product.toString()); console.log('Quotient (a / 3):', quotient.toString()); // Example of comparison if (a.cmp(b) > 0) { console.log('a is greater than b'); }
Debug
Known issues
breakingMany methods available in the original `node-bignum` library are explicitly *not* implemented in `browserify-bignum`, including `prime`, `toNumber`, bitwise operations (`and`, `or`, `xor`), `invertm`, `rand`, `probPrime`, `root`, `shiftLeft`, `shiftRight`, `gcd`, and `jacobi`. Direct migration from `node-bignum` will result in runtime errors if these methods are used.
fix
Review the list of unsupported methods in the README. If these methods are critical, consider using `bignumber.js` directly or a different modern arbitrary-precision library that supports them.
affects: >=1.0.0
gotchaThe package is effectively abandoned, with the last commit on its GitHub repository over nine years ago. It is not actively maintained, meaning bug fixes, security updates, or new features are highly unlikely.
fix
For new projects, consider modern, actively maintained alternatives like `bignumber.js`, `decimal.js`, or native `BigInt` (if integer-only operations are sufficient).
affects: >=1.0.0
gotchaThis library is designed for the Browserify ecosystem. Using it directly in modern Node.js ESM projects or with contemporary bundlers (Webpack, Rollup, Vite) without proper CommonJS compatibility layers may lead to issues or require additional configuration.
fix
Ensure your build setup correctly handles CommonJS modules if integrating into a modern frontend or backend project. For browsers, it's intended to be bundled via Browserify.
affects: >=1.0.0
gotchaDue to its age and lack of maintenance, the library might have unaddressed security vulnerabilities or rely on outdated dependencies. Using it in production environments without thorough security review is not recommended.
fix
Audit the source code and its (potentially transitive) dependencies for known vulnerabilities. Consider sandboxing or migrating to a more secure, maintained library.
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: BigNumber.prime is not a function
Attempting to use a method (`.prime()`, `.toNumber()`, `.and()`, etc.) that is present in `node-bignum` but explicitly omitted in `browserify-bignum`.
fix
Consult the `browserify-bignum` README for the list of unimplemented methods. If the functionality is required, migrate to `bignumber.js` or another library.
ReferenceError: require is not defined
Attempting to use `require('browserify-bignum')` directly in a browser environment without being processed by Browserify or another CommonJS-aware bundler.
fix
Ensure your browser-side code is bundled using Browserify. If using modern bundlers (Webpack/Rollup/Vite), confirm they are configured to correctly handle CommonJS modules.
Error: Cannot find module 'browserify-bignum'
The package is not installed, or the module resolution path is incorrect in a CommonJS environment (e.g., Node.js).
fix
Install the package via npm: `npm install browserify-bignum`. Verify your module resolution settings if using a custom environment.
Upgrade
Version history
1.3.0-2latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
12 hits · last 30 days
node
10
Amazon
1
OpenAI (training)
1
Resources