@@ -9,7 +9,7 @@ filesize.js provides a simple way to get a human readable file size string from
9
9
` filesize() ` accepts an optional descriptor Object as a second argument, so you can customize the output.
10
10
11
11
### base
12
- _ * (number)* _ Number base, default is ` 2 `
12
+ _ * (number)* _ Number base, default is ` 10 `
13
13
14
14
### bits
15
15
_ * (boolean)* _ Enables ` bit ` sizes, default is ` false `
@@ -51,10 +51,10 @@ _*(string)*_ Decimal separator character, default is `.`
51
51
_ * (string)* _ Character between the ` result ` and ` symbol ` , default is ` " " `
52
52
53
53
### 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 `
55
55
56
56
### 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
58
58
59
59
### unix
60
60
_ * (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
63
63
64
64
``` javascript
65
65
filesize (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 "}
72
72
filesize (1 , {symbols: {B : " Б" }}); // "1 Б"
73
- filesize (1024 ); // "1 KB "
73
+ filesize (1024 ); // "1.02 kB "
74
74
filesize (1024 , {exponent: 0 }); // "1024 B"
75
75
filesize (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"
78
78
filesize (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 "
81
81
```
82
82
83
83
## Partial Application
@@ -86,9 +86,9 @@ upon execution. This can be used to reduce `Object` creation if you call `filesi
86
86
in lexical scope.
87
87
88
88
``` javascript
89
- const size = filesize .partial ({standard: " iec " });
89
+ const size = filesize .partial ({base : 2 , standard: " jedec " });
90
90
91
- size (265318 ); // "259.1 KiB "
91
+ size (265318 ); // "259.1 KB "
92
92
```
93
93
94
94
## How can I load filesize.js?
0 commit comments