Skip to content

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

License

Notifications You must be signed in to change notification settings

Cloudxtreme/pretty-bytes

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

30 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

pretty-bytes Build Status

Convert bytes to a human readable string: 13371.34 kB

Useful for displaying file sizes for humans.

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

Install

$ npm install --save pretty-bytes

Usage

const prettyBytes = require('pretty-bytes');

prettyBytes(1337);
//=> '1.34 kB'

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

Related

License

MIT © Sindre Sorhus

About

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

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%