JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 19651880
  • Score
    100M100P100Q222634F
  • License MIT

Convert bytes to a human readable string: 1337 → 1.34 kB

Package Exports

  • pretty-bytes

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (pretty-bytes) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

pretty-bytes Build Status

Convert bytes to a human readable string: 13371.34 kB

Useful for displaying file sizes for humans.

Note that it uses base-10 (eg. kilobyte).
Read about the difference between kilobyte and kibibyte.

Install

$ npm install --save pretty-bytes

Usage

var prettyBytes = require('pretty-bytes');

prettyBytes(1337);
//=> '1.34 kB'

prettyBytes(100);
//=> '100 B'

CLI

$ npm install --global pretty-bytes
$ pretty-bytes --help

  Usage
    $ pretty-bytes <number>
    $ echo <number> | pretty-bytes

  Example
    $ pretty-bytes 1337
    1.34 kB

License

MIT © Sindre Sorhus