1.0.1 • Published 7 years ago

format-bytes v1.0.1

Weekly downloads
23
License
-
Repository
-
Last release
7 years ago

format-bytes.js

Formats a byte count for human reading.

Examples

formatBytes(8) === '8 bytes';
formatBytes(3171) === '3.17 KB';
formatBytes(Number.MAX_SAFE_INTEGER) === '9.01 PB';
formatBytes(Number.MAX_VALUE) === '1.80 × 10^308 bytes';

API

formatBytes(bytes)

Returns a string representing bytes for human reading. Uses the units bytes, KB, MBYB, with larger numbers in scientific notation. Rounding may occur.

bytes: An integer >= 0, the byte count to format.

1.0.1

7 years ago

1.0.0

7 years ago

0.0.0

7 years ago