8000 GitHub - ryanramage/filesize.js: JavaScript library to generate a human readable String describing the file size
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

ryanramage/filesize.js

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

33 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

filesize.js

filesize.js provides a simple way to get a human readable file size string from a number (float or integer) or string. An optional second parameter is the decimal place to round to (default is 2), or true which triggers Unix style output. The maximum supported size is a terabyte. When hard drives get bigger, I'll add support for petabytes.

Examples

filesize(1500);                   // "1.46KB"
filesize("1500000000");           // "1.40GB"
filesize("1500000000", 0);        // "1GB"
filesize(1212312421412412);       // "1102.59TB"
filesize(1212312421412412, true); // "1102.6T" - shorthand output, similar to *nix "ls -lh"

How can I load filesize.js?

filesize.js supports AMD loaders (require.js, curl.js, etc.), node.js & npm (npm install filesize), or using a script tag.

Information

License

filesize.js is licensed under BSD-3 http://www.opensource.org/licenses/BSD-3-Clause

Copyright

Copyright (c) 2012, Jason Mulligan jason.mulligan@avoidwork.com

About

4E4F JavaScript library to generate a human readable String describing the file size

Resources

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 100.0%
0