forked from DefinitelyTyped/DefinitelyTyped
-
Notifications
You must be signed in to change notification settings - Fork 0
/
filesize.d.ts
84 lines (76 loc) · 2.14 KB
/
filesize.d.ts
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
// Type definitions for filesize 3.2.1
// Project: https://github.com/avoidwork/filesize.js
// Definitions by: Giedrius Grabauskas <https://github.com/GiedriusGrabauskas>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
declare namespace Filesize {
export interface SiJedecBits {
b?: string;
Kb?: string;
Mb?: string;
Gb?: string;
Tb?: string;
Pb?: string;
Eb?: string;
Zb?: string;
Yb?: string;
}
export interface SiJedecBytes {
B?: string;
KB?: string;
MB?: string;
GB?: string;
TB?: string;
PB?: string;
EB?: string;
ZB?: string;
YB?: string;
}
type SiJedec = SiJedecBits & SiJedecBytes & { [name: string]: string };
export interface Options {
/**
* Enables bit sizes, default is false
*/
bits?: boolean;
/**
* Number base, default is 2
*/
base?: number;
/**
* Decimal place, default is 2
*/
round?: number;
/**
* Output of function (array, exponent, object, or string), default is string
*/
output?: string;
/**
* Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found
* @deprecated: use 'symbols'
*/
suffixes?: SiJedec;
/**
* Dictionary of SI/JEDEC symbols to replace for localization, defaults to english if no match is found
*/
symbols?: SiJedec;
/**
* Specifies the SI suffix via exponent, e.g. 2 is MB for bytes, default is -1
*/
exponent?: number;
/**
* Enables unix style human readable output, e.g ls -lh, default is false
*/
unix?: boolean;
/**
* Character between the result and suffix, default is " "
*/
spacer?: string;
}
export interface IFilesize {
(bytes: number): string;
(bytes: number, options: Options): string;
}
}
declare module "filesize" {
let fileSize: Filesize.IFilesize;
export = fileSize;
}