@@ -9,7 +9,7 @@ filesize.js provides a simple way to get a human readable file size string from
99` filesize() ` accepts an optional descriptor Object as a second argument, so you can customize the output.
1010
1111### base
12- _ * (number)* _ Number base, default is ` 2 `
12+ _ * (number)* _ Number base, default is ` 10 `
1313
1414### bits
1515_ * (boolean)* _ Enables ` bit ` sizes, default is ` false `
@@ -51,10 +51,10 @@ _*(string)*_ Decimal separator character, default is `.`
5151_ * (string)* _ Character between the ` result ` and ` symbol ` , default is ` " " `
5252
5353### standard
54- _ * (string)* _ Standard unit of measure, can be ` iec ` or ` jedec ` , default is ` jedec ` ; can be overruled by ` base `
54+ _ * (string)* _ Standard unit of measure, can be ` iec ` or ` jedec ` , default is ` iec ` ; can be overruled by ` base `
5555
5656### symbols
57- _ * (object)* _ Dictionary of SI/JEDEC/ IEC symbols to replace for localization, defaults to english if no match is found
57+ _ * (object)* _ Dictionary of SI/IEC/JEDEC symbols to replace for localization, defaults to english if no match is found
5858
5959### unix
6060_ * (boolean)* _ Enables unix style human readable output, e.g ` ls -lh ` , default is ` false `
@@ -63,21 +63,21 @@ _*(boolean)*_ Enables unix style human readable output, e.g `ls -lh`, default is
6363
6464``` javascript
6565filesize (500 ); // "500 B"
66- filesize (500 , {bits: true }); // "4 Kb "
67- filesize (265318 , {base: 10 }); // "265.32 kB "
68- filesize (265318 ); // "259.1 KB "
69- filesize (265318 , {round: 0 }); // "259 KB "
70- filesize (265318 , {output: " array" }); // [259.1 , "KB "]
71- filesize (265318 , {output: " object" }); // {value: 259.1 , symbol: "KB ", exponent: 1, unit: "KB "}
66+ filesize (500 , {bits: true }); // "4 kbit "
67+ filesize (265318 , {base: 2 }); // "259.1 KiB "
68+ filesize (265318 ); // "265.32 kB "
69+ filesize (265318 , {round: 0 }); // "265 kB "
70+ filesize (265318 , {output: " array" }); // [265.32 , "kB "]
71+ filesize (265318 , {output: " object" }); // {value: 265.32 , symbol: "kB ", exponent: 1, unit: "kB "}
7272filesize (1 , {symbols: {B : " Б" }}); // "1 Б"
73- filesize (1024 ); // "1 KB "
73+ filesize (1024 ); // "1.02 kB "
7474filesize (1024 , {exponent: 0 }); // "1024 B"
7575filesize (1024 , {output: " exponent" }); // 1
76- filesize (265318 , {standard: " iec " }); // "259.1 KiB "
77- filesize (265318 , {standard : " iec " , fullform: true }); // "259.1 kibibytes"
76+ filesize (265318 , {standard: " jedec " }); // "259.1 KB "
77+ filesize (265318 , {base : 2 , fullform: true }); // "259.1 kibibytes"
7878filesize (12 , {fullform: true , fullforms: [" байтов" ]}); // "12 байтов"
79- filesize (265318 , {separator: " ," }); // "259,1 KB "
80- filesize (265318 , {locale: " de" }); // "259,1 KB "
79+ filesize (265318 , {separator: " ," }); // "265,32 kB "
80+ filesize (265318 , {locale: " de" }); // "265,32 kB "
8181```
8282
8383## Partial Application
@@ -86,9 +86,9 @@ upon execution. This can be used to reduce `Object` creation if you call `filesi
8686in lexical scope.
8787
8888``` javascript
89- const size = filesize .partial ({standard: " iec " });
89+ const size = filesize .partial ({base : 2 , standard: " jedec " });
9090
91- size (265318 ); // "259.1 KiB "
91+ size (265318 ); // "259.1 KB "
9292```
9393
9494## How can I load filesize.js?
0 commit comments