The `filesize` library is a lightweight, high-performance JavaScript utility designed to convert byte values into human-readable strings, such as "1.02 kB" or "1 MiB". Currently at version 11.0.15, it emphasizes reliability and efficiency with zero external dependencies and 100% test coverage. Key differentiators include full TypeScript support, robust internationalization via the `Intl` API, `BigInt` compatibility for extremely large numbers, and support for multiple unit standards (SI, IEC, JEDEC). It offers a functional API with partial application for creating reusable formatters and is fully compatible with both Node.js and browser environments. While a specific release cadence isn't published, the project appears actively maintained with regular updates.
npm install filesizeVerified import paths — ran on the pinned version, not inferred.
Demonstrates basic filesize conversion, using different standards (SI, IEC), partial application for reusable formatters, and various output formats including string and object.
Adjust CommonJS `require` statements to use named destructuring: `const { filesize, partial } = require('filesize');`Upgrade Node.js to version 16 or higher, or pin the `filesize` package to a version less than 10.0.0.
Explicitly set the `standard` option if non-SI behavior is desired (e.g., `{ standard: 'iec', base: 2 }`). If relying on the 'suffix' option, refactor your code as it is no longer available.Always specify `{ standard: 'iec', base: 2 }` together for accurate binary IEC units.For ESM, use `import { filesize } from 'filesize';`. For CommonJS (since v10), use `const { filesize } = require('filesize');`.Ensure that `filesize` is explicitly imported as a named export. In CommonJS, this means `const { filesize } = require('filesize');`.Ensure the input to `filesize` is a valid `number` or `bigint`.
No dependency data recorded yet.