DEV Community

Andrew Usher
Andrew Usher

Posted on

NPM Needs: pretty-bytes

Note: this was originally posted on my personal site

What Is It?

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.

Usage Examples

import prettyBytes from 'pretty-bytes'

prettyBytes(100)
// '100 B'
prettyBytes(1650)
// '1.65 kB'
Enter fullscreen mode Exit fullscreen mode

More Info

Top comments (0)