-
-
Notifications
You must be signed in to change notification settings - Fork 2.3k
/
filesize.js.flow
128 lines (105 loc) 路 2.56 KB
/
filesize.js.flow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
/**
* Flowtype definitions for filesize
* Generated by Flowgen from a Typescript Definition
* Flowgen v1.13.0
* @flow
*/
declare module 'fileSize' { // manually added
declare var fileSize: Filesize$Filesize;
declare export default typeof fileSize;
declare var npm$namespace$Filesize: {|
SiJedecBits: Class<Filesize$SiJedecBits>,
SiJedecBytes: Class<Filesize$SiJedecBytes>,
Options: Class<Filesize$Options>,
Filesize: Class<Filesize$Filesize>,
|};
declare interface Filesize$SiJedecBits {
b?: string;
Kb?: string;
Mb?: string;
Gb?: string;
Tb?: string;
Pb?: string;
Eb?: string;
Zb?: string;
Yb?: string;
}
declare interface Filesize$SiJedecBytes {
B?: string;
KB?: string;
MB?: string;
GB?: string;
TB?: string;
PB?: string;
EB?: string;
ZB?: string;
YB?: string;
}
declare type Filesize$SiJedec = Filesize$SiJedecBits &
Filesize$SiJedecBytes & {
[name: string]: string,
...
};
declare interface Filesize$Options {
/**
* Number base, default is 2
*/
base?: number;
/**
* Enables bit sizes, default is false
*/
bits?: boolean;
/**
* Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1
*/
exponent?: number;
/**
* Enables full form of unit of measure, default is false
*/
fullform?: boolean;
/**
* Array of full form overrides, default is []
*/
fullforms?: string[];
/**
* BCP 47 language tag to specify a locale, or true to use default locale, default is ""
*/
locale?: string | boolean;
/**
* ECMA-402 number format option overrides, default is "{}"
*/
localeOptions?: Intl.NumberFormatOptions;
/**
* Output of function (array, exponent, object, or string), default is string
*/
output?: "array" | "exponent" | "object" | "string";
/**
* Decimal place, default is 2
*/
round?: number;
/**
* Decimal separator character, default is `.`
*/
separator?: string;
/**
* Character between the result and suffix, default is ` `
*/
spacer?: string;
/**
* Standard unit of measure, can be iec or jedec, default is jedec; can be overruled by base
*/
standard?: "iec" | "jedec";
/**
* Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found
*/
symbols?: Filesize$SiJedec;
/**
* Enables unix style human readable output, e.g ls -lh, default is false
*/
unix?: boolean;
}
declare interface Filesize$Filesize {
(bytes: number, options?: Filesize$Options): string;
partial: (options: Filesize$Options) => (bytes: number) => string;
}
}