Skip to content

Convert bytes to a human readable string: 1337 → 1.34 kB

Notifications You must be signed in to change notification settings

lonelyclick/pretty-byte

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Fork by pretty-bytes diff 1024

Convert bytes to a human readable string: 13371.31 kB

Useful for displaying file sizes for humans.

Note that it uses base-1024 (eg. kibibyte).
Read about the difference between kilobyte and kibibyte.

Install

$ npm install --save pretty-byte

Usage

const prettyByte = require('pretty-byte');

prettyByte(1337);
//=> '1.31 kB'

prettyByte(100);
//=> '100 B'

License

MIT

About

Convert bytes to a human readable string: 1337 → 1.34 kB

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%