NPM Needs: snarkdown
1 min read
npm javascript
pretty-bytes is a utility used to convert an integer form of bytes to a more human readable form (bytes to kilobytes, for example). pretty-bytes-cli is a command line wrapper for the same package.
import prettyBytes from 'pretty-bytes'
prettyBytes(100)
// '100 B'
prettyBytes(1650)
// '1.65 kB'
If you liked this article and think others should read it, please share it on Twitter!