UNPKG

1.62 kBTypeScriptView Raw
1/// <reference types="node" />
2
3declare namespace size {
4 interface Options {
5 /**
6 * Displays the size of every file instead of just the total size.
7 *
8 * @default false
9 */
10 showFiles?: boolean | undefined;
11
12 /**
13 * Displays the gzipped size.
14 *
15 * @default false
16 */
17 gzip?: boolean | undefined;
18
19 /**
20 * Give it a title so it's possible to distinguish the output of multiple instances logging at once.
21 *
22 * @default ''
23 */
24 title?: string | undefined;
25
26 /**
27 * Displays prettified size: 1337 B → 1.34 kB.
28 *
29 * @default true
30 */
31 pretty?: boolean | undefined;
32
33 /**
34 * Displays the total of all files.
35 *
36 * @default true
37 */
38 showTotal?: boolean | undefined;
39
40 /**
41 * Displays the brotli compressed size.
42 *
43 * @default false
44 */
45 brotli?: boolean | undefined;
46
47 /**
48 * Displays the uncompressed size.
49 *
50 * @default false
51 */
52 uncompressed?: boolean | undefined;
53 }
54
55 interface SizeStream extends NodeJS.ReadWriteStream {
56 /**
57 * The total size of all files in bytes.
58 *
59 * @example 12423000
60 */
61 size: number;
62
63 /**
64 * Prettified version of .size.
65 *
66 * @example 14 kB
67 */
68 prettySize: string;
69 }
70}
71
72declare function size(options?: size.Options): size.SizeStream;
73
74export = size;