★ wanayoo — archive 1999 https://github.com/avoidwork/filesize.jsNouvelle recherche | Portail wanayoo
This repository
This repository
All repositories

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

JavaScript Show File Finder
README.md

build status

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. An optional third parameter lets you disable bit sizes, e.g. "kb".

Examples

1.10.0 switched to base 10, all previous versions use base 2.

filesize(500);                    // "4.00 Kb"
filesize(500, true);              // "4.0k"
filesize(1500);                   // "1.50 KB"
filesize("1500000000");           // "1.50 GB"
filesize("1500000000", 0);        // "2GB"
filesize(1212312421412412);       // "1.21 PB PB"
filesize(1212312421412412, true); // "1.1P" - shorthand output, similar to "ls -h"
filesize(265318, 2, false)        // "265.32 kB" - disabled `bit` sizes with third argument

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.

Support

If you're having problems with using the project, use the support forum at CodersClan.

License

filesize.js is licensed under BSD-3 https://raw.github.com/avoidwork/filesize.js/master/LICENSE

Copyright

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

Something went wrong with that request. Please try again.