Registry / developer tools / si
library2.0.0jsnpmunverified

A Node.js module for parsing and formatting large numbers with SI (metric) prefixes like '10gb' to 1000000000. This package (v2.0.0, last updated in 2012) is a simple, lightweight library that provides parse() and format() functions, making human-readable number inputs easy in CLI arguments or configs. It supports prefixes from k (kilo) to E (exa) and vice versa. Release cadence is dormant; no updates in over a decade. Differentiator: minimalistic, no dependencies, focuses solely on SI notation without IEC binary support.

npm install si
INSTALL
IMPORT
SIG · SI
S
si
developer toolsjavascriptv2.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

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

* as si
import * as si from 'si'
const si = require('si')
Package is CommonJS only; ESM import may require bundler transformation.
parse
import { parse } from 'si'
import parse from 'si'
Package exports an object, not named exports. Named import only works if package is treated as a module with named exports.
format
import { format } from 'si'
import format from 'si'
Same as parse: format is a property of the default export.

Demonstrates basic parse and format functions with SI prefixes.

import * as si from 'si'; const number = si.parse('10G'); console.log(number); // 10000000000 const formatted = si.format(1234567); console.log(formatted); // '1.235M'
Debug
Known issues
deprecatedPackage has not been updated since 2012 and is effectively unmaintained.
fix
Consider using 'filesize' or 'humanize-plus' as modern alternatives.
affects: >=2.0.0
gotchaCase-insensitive parsing: 'M' and 'm' both treated as mega (1e6), not milli.
fix
Use IEC prefixes like 'MiB' not supported. Be aware that 'm' means mega, not milli.
affects: >=0.0.1
gotchaparse('1k') returns 1000, not 1024. No binary prefix support.
fix
Use a library like 'bytes' for binary interpretation.
affects: >=0.0.1
gotchaformat() output rounding may lose precision for very large numbers.
fix
Pass desired decimal places as second argument (e.g., si.format(1234567, 4) gives '1.2346M').
affects: >=0.0.1
Errors
Common errors & fixes
Cannot find module 'si'
Package not installed or not in node_modules.
fix
Run 'npm install si' or add to package.json dependencies.
si is not a function
Using original require as a function instead of require('si').
fix
Use const si = require('si'); then si.parse().
TypeError: si.parse is not a function
Incorrect import path (e.g., import from 'si/src').
fix
Use require('si') or import * as si from 'si'.
Upgrade
Version history
2.0.0latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
17 hits · last 30 days
node
16
Amazon
1
Resources
packagesi
si — npm install si · libregistry