Repository navigation
Expand file tree
/
Copy pathnode.d.ts
More file actions
243 lines (228 loc) · 8.82 KB
/
Copy pathnode.d.ts
File metadata and controls
243 lines (228 loc) · 8.82 KB
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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
import type { Transform } from 'node:stream';
/**
* Create a Node.js stream.Transform for zstd compression.
*
* Uses Node.js `stream.Transform` to provide chunked compression compatible
* with `stream.pipeline()` and pipe-based workflows.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param level Compression level (1-22, or negative for fast mode). Default is 3.
*/
export declare function createZstdCompressTransform(level?: number): Transform;
/**
* Create a Node.js stream.Transform for zstd decompression.
*
* Uses Node.js `stream.Transform` to provide chunked decompression compatible
* with `stream.pipeline()` and pipe-based workflows.
*
* The transform emits an error if the input ends before the compressed stream
* does, including empty input.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createZstdDecompressTransform(maxOutputSize?: number): Transform;
/**
* Create a Node.js stream.Transform for gzip compression.
*
* Uses Node.js `stream.Transform` to provide chunked gzip compression compatible
* with `stream.pipeline()` and pipe-based workflows.
* Produces spec-compliant gzip output with proper header and CRC32 footer.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param level Compression level (0-9). Default is 6.
*/
export declare function createGzipCompressTransform(level?: number): Transform;
/**
* Create a Node.js stream.Transform for gzip decompression.
*
* Uses Node.js `stream.Transform` to provide chunked gzip decompression compatible
* with `stream.pipeline()` and pipe-based workflows.
* Verifies CRC32 integrity on finalization.
*
* The transform emits an error if the input ends before the compressed stream
* does, including empty input.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createGzipDecompressTransform(maxOutputSize?: number): Transform;
/**
* Create a Node.js stream.Transform for raw deflate compression.
*
* Uses Node.js `stream.Transform` to provide chunked raw deflate compression
* (no gzip header/footer) compatible with `stream.pipeline()` and pipe-based workflows.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param level Compression level (0-9). Default is 6.
*/
export declare function createDeflateCompressTransform(level?: number): Transform;
/**
* Create a Node.js stream.Transform for raw deflate decompression.
*
* Uses Node.js `stream.Transform` to provide chunked raw deflate decompression
* compatible with `stream.pipeline()` and pipe-based workflows.
*
* The transform emits an error if the input ends before the compressed stream
* does, including empty input.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createDeflateDecompressTransform(maxOutputSize?: number): Transform;
/**
* Create a Node.js stream.Transform for brotli compression.
*
* Uses Node.js `stream.Transform` to provide chunked brotli compression compatible
* with `stream.pipeline()` and pipe-based workflows.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param quality Compression quality (0-11). Default is 6.
*/
export declare function createBrotliCompressTransform(quality?: number): Transform;
/**
* Create a Node.js stream.Transform for brotli decompression.
*
* Uses Node.js `stream.Transform` to provide chunked brotli decompression compatible
* with `stream.pipeline()` and pipe-based workflows.
*
* The transform emits an error if the input ends before the compressed stream
* does, including empty input.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createBrotliDecompressTransform(maxOutputSize?: number): Transform;
/**
* Create a Node.js stream.Transform for LZ4 frame compression.
*
* Uses Node.js `stream.Transform` to provide chunked LZ4 compression compatible
* with `stream.pipeline()` and pipe-based workflows.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*/
export declare function createLz4CompressTransform(): Transform;
/**
* Create a Node.js stream.Transform for LZ4 frame decompression.
*
* Uses Node.js `stream.Transform` to provide chunked LZ4 decompression compatible
* with `stream.pipeline()` and pipe-based workflows.
*
* The input may hold several concatenated frames, including skippable and
* legacy frames. The transform emits an error if the input ends inside a
* frame, including empty input, or if data that is not a frame follows a
* frame.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createLz4DecompressTransform(maxOutputSize?: number): Transform;
/**
* Create a Node.js stream.Transform for zstd compression with a pre-trained dictionary.
*
* Uses Node.js `stream.Transform` to provide chunked compression with a pre-trained
* dictionary, compatible with `stream.pipeline()` and pipe-based workflows.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param dict Pre-trained dictionary (from `zstdTrainDictionary`).
* @param level Compression level (1-22, or negative for fast mode). Default is 3.
*/
export declare function createZstdCompressDictTransform(
dict: Buffer | Uint8Array,
level?: number,
): Transform;
/**
* Create a Node.js stream.Transform for zstd decompression with a pre-trained dictionary.
*
* Uses Node.js `stream.Transform` to provide chunked decompression with a pre-trained
* dictionary, compatible with `stream.pipeline()` and pipe-based workflows.
*
* The transform emits an error if the input ends before the compressed stream
* does, including empty input.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param dict Pre-trained dictionary (must match the one used for compression).
*/
export declare function createZstdDecompressDictTransform(
dict: Buffer | Uint8Array,
maxOutputSize?: number,
): Transform;
/**
* Create a Node.js stream.Transform for brotli compression with a custom dictionary.
*
* Uses Node.js `stream.Transform` to provide chunked compression with a custom
* dictionary, compatible with `stream.pipeline()` and pipe-based workflows.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param dict Custom dictionary bytes.
* @param quality Compression quality (0-11). Default is 6.
*/
export declare function createBrotliCompressDictTransform(
dict: Buffer | Uint8Array,
quality?: number,
): Transform;
/**
* Create a Node.js stream.Transform for brotli decompression with a custom dictionary.
*
* Uses Node.js `stream.Transform` to provide chunked decompression with a custom
* dictionary, compatible with `stream.pipeline()` and pipe-based workflows.
*
* The transform emits an error if the input ends before the compressed stream
* does, including empty input.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param dict Custom dictionary (must match the one used for compression).
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createBrotliDecompressDictTransform(
dict: Buffer | Uint8Array,
maxOutputSize?: number,
): Transform;
/**
* Create a Node.js stream.Transform for auto-detect decompression.
*
* Detects the compression format (zstd, gzip, brotli, or lz4) like
* `detectFormat` and delegates to the appropriate decompression context.
* Raw deflate is not supported (no magic bytes to distinguish it).
*
* The input is buffered until the format is detected: up to 64 KiB, or the
* whole input if it is shorter, since brotli has no magic bytes and its
* detection may need that much. The transform emits an error if the format
* is still unknown then.
*
* The transform emits an error on empty input, which has no format to detect,
* and on zstd, gzip or brotli input that ends before the compressed stream does.
*
* Output chunks hold at most `readableHighWaterMark` bytes (64 KiB by
* default).
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createDecompressTransform(maxOutputSize?: number): Transform;