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