A lightweight utility to convert byte counts into human-readable strings (e.g., 1024 → "1 kB") for logging and CLI output. Version 2.0.0 supports sizes from bytes up to exabytes, with options to remove spaces, use single-character suffixes, control decimal places, or return only the numeric value. Minimal dependencies, pure JavaScript, works in Node.js and browsers. Alternatives like filesize.js offer more formatting features, but prettysize focuses on simplicity and small footprint.
npm install prettysizeVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic usage with a byte value, shows options for no space, single character suffix, decimal places, and numeric-only output.
Update code to expect one decimal place by default, or explicitly set places option.
Use options object: { nospace: true, one: true, places: 2 } instead of positional args.Use { nospace: true } to remove space, or { numOnly: true } to get a number directly.Use `const pretty = require('prettysize');` not `const { pretty } = require('prettysize');`Use `import pretty from 'prettysize'` (with bundler) or `createRequire` from 'module'.
No dependency data recorded yet.