1 | declare module "zlib" {
|
2 | import * as stream from "stream";
|
3 |
|
4 | interface ZlibOptions {
|
5 | flush?: number;
|
6 | finishFlush?: number;
|
7 | chunkSize?: number;
|
8 | windowBits?: number;
|
9 | level?: number;
|
10 | memLevel?: number;
|
11 | strategy?: number;
|
12 | dictionary?: Buffer | NodeJS.TypedArray | DataView | ArrayBuffer;
|
13 | info?: boolean;
|
14 | }
|
15 |
|
16 | interface BrotliOptions {
|
17 | |
18 |
|
19 |
|
20 | flush?: number;
|
21 | |
22 |
|
23 |
|
24 | finishFlush?: number;
|
25 | |
26 |
|
27 |
|
28 | chunkSize?: number;
|
29 | params?: {
|
30 | |
31 |
|
32 |
|
33 | [key: number]: boolean | number;
|
34 | };
|
35 | }
|
36 |
|
37 | interface Zlib {
|
38 |
|
39 | readonly bytesRead: number;
|
40 | readonly bytesWritten: number;
|
41 | shell?: boolean | string;
|
42 | close(callback?: () => void): void;
|
43 | flush(kind?: number, callback?: () => void): void;
|
44 | flush(callback?: () => void): void;
|
45 | }
|
46 |
|
47 | interface ZlibParams {
|
48 | params(level: number, strategy: number, callback: () => void): void;
|
49 | }
|
50 |
|
51 | interface ZlibReset {
|
52 | reset(): void;
|
53 | }
|
54 |
|
55 | interface BrotliCompress extends stream.Transform, Zlib { }
|
56 | interface BrotliDecompress extends stream.Transform, Zlib { }
|
57 | interface Gzip extends stream.Transform, Zlib { }
|
58 | interface Gunzip extends stream.Transform, Zlib { }
|
59 | interface Deflate extends stream.Transform, Zlib, ZlibReset, ZlibParams { }
|
60 | interface Inflate extends stream.Transform, Zlib, ZlibReset { }
|
61 | interface DeflateRaw extends stream.Transform, Zlib, ZlibReset, ZlibParams { }
|
62 | interface InflateRaw extends stream.Transform, Zlib, ZlibReset { }
|
63 | interface Unzip extends stream.Transform, Zlib { }
|
64 |
|
65 | function createBrotliCompress(options?: BrotliOptions): BrotliCompress;
|
66 | function createBrotliDecompress(options?: BrotliOptions): BrotliDecompress;
|
67 | function createGzip(options?: ZlibOptions): Gzip;
|
68 | function createGunzip(options?: ZlibOptions): Gunzip;
|
69 | function createDeflate(options?: ZlibOptions): Deflate;
|
70 | function createInflate(options?: ZlibOptions): Inflate;
|
71 | function createDeflateRaw(options?: ZlibOptions): DeflateRaw;
|
72 | function createInflateRaw(options?: ZlibOptions): InflateRaw;
|
73 | function createUnzip(options?: ZlibOptions): Unzip;
|
74 |
|
75 | type InputType = string | Buffer | DataView | ArrayBuffer | NodeJS.TypedArray;
|
76 |
|
77 | type CompressCallback = (error: Error | null, result: Buffer) => void;
|
78 |
|
79 | function brotliCompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
80 | function brotliCompress(buf: InputType, callback: CompressCallback): void;
|
81 | namespace brotliCompress {
|
82 | function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
|
83 | }
|
84 |
|
85 | function brotliCompressSync(buf: InputType, options?: BrotliOptions): Buffer;
|
86 |
|
87 | function brotliDecompress(buf: InputType, options: BrotliOptions, callback: CompressCallback): void;
|
88 | function brotliDecompress(buf: InputType, callback: CompressCallback): void;
|
89 | namespace brotliDecompress {
|
90 | function __promisify__(buffer: InputType, options?: BrotliOptions): Promise<Buffer>;
|
91 | }
|
92 |
|
93 | function brotliDecompressSync(buf: InputType, options?: BrotliOptions): Buffer;
|
94 |
|
95 | function deflate(buf: InputType, callback: CompressCallback): void;
|
96 | function deflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
97 | namespace deflate {
|
98 | function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
99 | }
|
100 |
|
101 | function deflateSync(buf: InputType, options?: ZlibOptions): Buffer;
|
102 |
|
103 | function deflateRaw(buf: InputType, callback: CompressCallback): void;
|
104 | function deflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
105 | namespace deflateRaw {
|
106 | function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
107 | }
|
108 |
|
109 | function deflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
|
110 |
|
111 | function gzip(buf: InputType, callback: CompressCallback): void;
|
112 | function gzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
113 | namespace gzip {
|
114 | function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
115 | }
|
116 |
|
117 | function gzipSync(buf: InputType, options?: ZlibOptions): Buffer;
|
118 |
|
119 | function gunzip(buf: InputType, callback: CompressCallback): void;
|
120 | function gunzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
121 | namespace gunzip {
|
122 | function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
123 | }
|
124 |
|
125 | function gunzipSync(buf: InputType, options?: ZlibOptions): Buffer;
|
126 |
|
127 | function inflate(buf: InputType, callback: CompressCallback): void;
|
128 | function inflate(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
129 | namespace inflate {
|
130 | function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
131 | }
|
132 |
|
133 | function inflateSync(buf: InputType, options?: ZlibOptions): Buffer;
|
134 |
|
135 | function inflateRaw(buf: InputType, callback: CompressCallback): void;
|
136 | function inflateRaw(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
137 | namespace inflateRaw {
|
138 | function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
139 | }
|
140 |
|
141 | function inflateRawSync(buf: InputType, options?: ZlibOptions): Buffer;
|
142 |
|
143 | function unzip(buf: InputType, callback: CompressCallback): void;
|
144 | function unzip(buf: InputType, options: ZlibOptions, callback: CompressCallback): void;
|
145 | namespace unzip {
|
146 | function __promisify__(buffer: InputType, options?: ZlibOptions): Promise<Buffer>;
|
147 | }
|
148 |
|
149 | function unzipSync(buf: InputType, options?: ZlibOptions): Buffer;
|
150 |
|
151 | namespace constants {
|
152 |
|
153 |
|
154 | const Z_NO_FLUSH: number;
|
155 | const Z_PARTIAL_FLUSH: number;
|
156 | const Z_SYNC_FLUSH: number;
|
157 | const Z_FULL_FLUSH: number;
|
158 | const Z_FINISH: number;
|
159 | const Z_BLOCK: number;
|
160 | const Z_TREES: number;
|
161 |
|
162 |
|
163 |
|
164 | const Z_OK: number;
|
165 | const Z_STREAM_END: number;
|
166 | const Z_NEED_DICT: number;
|
167 | const Z_ERRNO: number;
|
168 | const Z_STREAM_ERROR: number;
|
169 | const Z_DATA_ERROR: number;
|
170 | const Z_MEM_ERROR: number;
|
171 | const Z_BUF_ERROR: number;
|
172 | const Z_VERSION_ERROR: number;
|
173 |
|
174 |
|
175 |
|
176 | const Z_NO_COMPRESSION: number;
|
177 | const Z_BEST_SPEED: number;
|
178 | const Z_BEST_COMPRESSION: number;
|
179 | const Z_DEFAULT_COMPRESSION: number;
|
180 |
|
181 |
|
182 |
|
183 | const Z_FILTERED: number;
|
184 | const Z_HUFFMAN_ONLY: number;
|
185 | const Z_RLE: number;
|
186 | const Z_FIXED: number;
|
187 | const Z_DEFAULT_STRATEGY: number;
|
188 |
|
189 | const BROTLI_DECODE: number;
|
190 | const BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES: number;
|
191 | const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP: number;
|
192 | const BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES: number;
|
193 | const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1: number;
|
194 | const BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2: number;
|
195 | const BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS: number;
|
196 | const BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET: number;
|
197 | const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1: number;
|
198 | const BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2: number;
|
199 | const BROTLI_DECODER_ERROR_FORMAT_CL_SPACE: number;
|
200 | const BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT: number;
|
201 | const BROTLI_DECODER_ERROR_FORMAT_DICTIONARY: number;
|
202 | const BROTLI_DECODER_ERROR_FORMAT_DISTANCE: number;
|
203 | const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE: number;
|
204 | const BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE: number;
|
205 | const BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE: number;
|
206 | const BROTLI_DECODER_ERROR_FORMAT_PADDING_1: number;
|
207 | const BROTLI_DECODER_ERROR_FORMAT_PADDING_2: number;
|
208 | const BROTLI_DECODER_ERROR_FORMAT_RESERVED: number;
|
209 | const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET: number;
|
210 | const BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME: number;
|
211 | const BROTLI_DECODER_ERROR_FORMAT_TRANSFORM: number;
|
212 | const BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS: number;
|
213 | const BROTLI_DECODER_ERROR_INVALID_ARGUMENTS: number;
|
214 | const BROTLI_DECODER_ERROR_UNREACHABLE: number;
|
215 | const BROTLI_DECODER_NEEDS_MORE_INPUT: number;
|
216 | const BROTLI_DECODER_NEEDS_MORE_OUTPUT: number;
|
217 | const BROTLI_DECODER_NO_ERROR: number;
|
218 | const BROTLI_DECODER_PARAM_DISABLE_RING_BUFFER_REALLOCATION: number;
|
219 | const BROTLI_DECODER_PARAM_LARGE_WINDOW: number;
|
220 | const BROTLI_DECODER_RESULT_ERROR: number;
|
221 | const BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT: number;
|
222 | const BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT: number;
|
223 | const BROTLI_DECODER_RESULT_SUCCESS: number;
|
224 | const BROTLI_DECODER_SUCCESS: number;
|
225 |
|
226 | const BROTLI_DEFAULT_MODE: number;
|
227 | const BROTLI_DEFAULT_QUALITY: number;
|
228 | const BROTLI_DEFAULT_WINDOW: number;
|
229 | const BROTLI_ENCODE: number;
|
230 | const BROTLI_LARGE_MAX_WINDOW_BITS: number;
|
231 | const BROTLI_MAX_INPUT_BLOCK_BITS: number;
|
232 | const BROTLI_MAX_QUALITY: number;
|
233 | const BROTLI_MAX_WINDOW_BITS: number;
|
234 | const BROTLI_MIN_INPUT_BLOCK_BITS: number;
|
235 | const BROTLI_MIN_QUALITY: number;
|
236 | const BROTLI_MIN_WINDOW_BITS: number;
|
237 |
|
238 | const BROTLI_MODE_FONT: number;
|
239 | const BROTLI_MODE_GENERIC: number;
|
240 | const BROTLI_MODE_TEXT: number;
|
241 |
|
242 | const BROTLI_OPERATION_EMIT_METADATA: number;
|
243 | const BROTLI_OPERATION_FINISH: number;
|
244 | const BROTLI_OPERATION_FLUSH: number;
|
245 | const BROTLI_OPERATION_PROCESS: number;
|
246 |
|
247 | const BROTLI_PARAM_DISABLE_LITERAL_CONTEXT_MODELING: number;
|
248 | const BROTLI_PARAM_LARGE_WINDOW: number;
|
249 | const BROTLI_PARAM_LGBLOCK: number;
|
250 | const BROTLI_PARAM_LGWIN: number;
|
251 | const BROTLI_PARAM_MODE: number;
|
252 | const BROTLI_PARAM_NDIRECT: number;
|
253 | const BROTLI_PARAM_NPOSTFIX: number;
|
254 | const BROTLI_PARAM_QUALITY: number;
|
255 | const BROTLI_PARAM_SIZE_HINT: number;
|
256 | }
|
257 |
|
258 |
|
259 |
|
260 | const Z_NO_FLUSH: number;
|
261 |
|
262 | const Z_PARTIAL_FLUSH: number;
|
263 |
|
264 | const Z_SYNC_FLUSH: number;
|
265 |
|
266 | const Z_FULL_FLUSH: number;
|
267 |
|
268 | const Z_FINISH: number;
|
269 |
|
270 | const Z_BLOCK: number;
|
271 |
|
272 | const Z_TREES: number;
|
273 |
|
274 |
|
275 |
|
276 |
|
277 | const Z_OK: number;
|
278 |
|
279 | const Z_STREAM_END: number;
|
280 |
|
281 | const Z_NEED_DICT: number;
|
282 |
|
283 | const Z_ERRNO: number;
|
284 |
|
285 | const Z_STREAM_ERROR: number;
|
286 |
|
287 | const Z_DATA_ERROR: number;
|
288 |
|
289 | const Z_MEM_ERROR: number;
|
290 |
|
291 | const Z_BUF_ERROR: number;
|
292 |
|
293 | const Z_VERSION_ERROR: number;
|
294 |
|
295 |
|
296 |
|
297 | const Z_NO_COMPRESSION: number;
|
298 |
|
299 | const Z_BEST_SPEED: number;
|
300 |
|
301 | const Z_BEST_COMPRESSION: number;
|
302 |
|
303 | const Z_DEFAULT_COMPRESSION: number;
|
304 |
|
305 |
|
306 |
|
307 | const Z_FILTERED: number;
|
308 |
|
309 | const Z_HUFFMAN_ONLY: number;
|
310 |
|
311 | const Z_RLE: number;
|
312 |
|
313 | const Z_FIXED: number;
|
314 |
|
315 | const Z_DEFAULT_STRATEGY: number;
|
316 |
|
317 |
|
318 | const Z_BINARY: number;
|
319 |
|
320 | const Z_TEXT: number;
|
321 |
|
322 | const Z_ASCII: number;
|
323 |
|
324 | const Z_UNKNOWN: number;
|
325 |
|
326 | const Z_DEFLATED: number;
|
327 | }
|