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