jack e1a2621c78 update | 2 anos atrás | |
---|---|---|
.. | ||
cli.js | 2 anos atrás | |
license | 2 anos atrás | |
package.json | 2 anos atrás | |
pretty-bytes.js | 2 anos atrás | |
readme.md | 2 anos atrás |
Convert bytes to a human readable string:
1337
→1.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.
$ npm install --save pretty-bytes
$ bower install --save pretty-bytes
$ component install sindresorhus/pretty-bytes
prettyBytes(1337);
//=> '1.34 kB'
prettyBytes(100);
//=> '100 B'
$ npm install --global pretty-bytes
$ pretty-bytes --help
Usage
$ pretty-bytes <number>
$ echo <number> | pretty-bytes
Example
$ pretty-bytes 1337
1.34 kB
MIT © Sindre Sorhus