1.1.0 • Published 6 years ago
nice-bytes v1.1.0
nice-bytes
Pretty format a number as bytes
Example
const niceBytes = require('nice-bytes')
niceBytes(64 * 1024).text // '65.54kB'Documentation
The niceBytes function returns meta information about how
to format the text.
const info = niceBytes(bytes)
Given a number bytes it returns an info object with
suffix; a string likeBorMBorkBmagnitude; same as suffic but as a numberresult; the amount of mb / kb / gb etc.fixed; same as result but fixed to two digits as a stringtext; The text format ( fixed + suffix ).
install
% npm install nice-bytesMIT Licensed
1.1.0
6 years ago