You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
rdrew
1440706ce3
|
6 years ago | |
---|---|---|
.. | ||
index.js | 6 years ago | |
license | 6 years ago | |
package.json | 6 years ago | |
readme.md | 6 years ago |
readme.md
pretty-bytes
Convert bytes to a human readable string:
1337
→1.34 kB
Useful for displaying file sizes for humans.
Note that it uses base-10 (e.g. kilobyte).
Read about the difference between kilobyte and kibibyte.
Install
$ npm install --save pretty-bytes
Usage
const prettyBytes = require('pretty-bytes');
prettyBytes(1337);
//=> '1.34 kB'
prettyBytes(100);
//=> '100 B'
Related
- pretty-bytes-cli - CLI for this module
License
MIT © Sindre Sorhus