Helper utility to provide pretty printed file sizes (best used for logging or CLI output)
Note: as of version 1.x this module is now using some ES6+ features, if you are using this in a browser you need to transform your code so that this doesn't break.
npm install prettysize
const pretty = ;let str = ;//str = "1 kB"str = ;//str = "1 MB"str = ;//str = "117.7 MB"
It supports the following sizes:
;/*First arg is sizeSecond argument is to remove the space from the outputThird argument is to use a single character for the size.Forth argument is the number of decimal places to return, default is 1.*/let str = ;//str = "1MB"str = // pretty(123456789, true, true);//str = "117.7M"str = // pretty(123456789, false, true);//str = "117.7 M"str = // pretty(123456789, false, true, 2);//str = "117.74 M"str = // pretty(123456789, false, true, 3);//str = "117.738 M"