A lightweight JavaScript/TypeScript library for converting byte values into human-readable strings with units (bytes, KB, MB, GB, TB, PB). Version 21.6.15 is stable and actively maintained (no recent releases). It follows IEEE 1541 (binary prefix) standard: 1 KB = 1024 bytes. Ships TypeScript definitions. Differentiators: zero dependencies, simple API, focus on binary units (as opposed to metric in 'pretty-bytes').
npm install bytes-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows basic formatting of byte values to human-readable strings using the formatBytes function.
Check your expected unit system. For metric, consider 'filesize' or 'humanize-plus'.
Ensure input is a number: formatBytes(Number(value))
If you need custom precision, post-process the string or choose an alternative library.
Pin exact version in package.json if stability is critical.
Run `npm install bytes-formatter` and ensure import path is exactly 'bytes-formatter'.
Use `import { formatBytes } from 'bytes-formatter'` instead of `import formatBytes from 'bytes-formatter'`.Switch to ES module import syntax or use a bundler that can handle ESM. Alternatively, use `await import('bytes-formatter')` if using dynamic import.No dependency data recorded yet.