Repository navigation
Expand file tree
/
Copy pathstreams.d.ts
More file actions
260 lines (246 loc) · 10.2 KB
/
Copy pathstreams.d.ts
File metadata and controls
260 lines (246 loc) · 10.2 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
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
/**
* Create a streaming brotli compression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked compression.
* Data compressed across multiple chunks maintains cross-chunk context for
* optimal compression ratio.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param quality Compression quality (0-11). Default is 6.
*/
export declare function createBrotliCompressStream(
quality?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming brotli decompression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked decompression.
*
* The stream errors if the input ends before the compressed stream does,
* including empty input.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createBrotliDecompressStream(
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming zstd compression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked compression.
* Data compressed across multiple chunks maintains cross-chunk context for
* optimal compression ratio.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param level Compression level (1-22, or negative for fast mode). Default is 3.
*/
export declare function createZstdCompressStream(
level?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming zstd decompression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked decompression.
*
* The stream errors if the input ends before the compressed stream does,
* including empty input.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createZstdDecompressStream(
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming gzip compression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked gzip compression.
* Produces spec-compliant gzip output with proper header and CRC32 footer.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param level Compression level (0-9). Default is 6.
*/
export declare function createGzipCompressStream(
level?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming gzip decompression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked gzip decompression.
* Verifies CRC32 integrity on finalization.
*
* The stream errors if the input ends before the compressed stream does,
* including empty input.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createGzipDecompressStream(
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming raw deflate compression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked raw deflate
* compression (no gzip header/footer).
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param level Compression level (0-9). Default is 6.
*/
export declare function createDeflateCompressStream(
level?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming raw deflate decompression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked raw deflate
* decompression.
*
* The stream errors if the input ends before the compressed stream does,
* including empty input.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createDeflateDecompressStream(
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming LZ4 frame compression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked LZ4 compression.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*/
export declare function createLz4CompressStream(): TransformStream<
ArrayBufferLike | ArrayBufferView,
Uint8Array
>;
/**
* Create a streaming LZ4 frame decompression TransformStream.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked LZ4 decompression.
*
* The input may hold several concatenated frames, including skippable and
* legacy frames. The stream errors if the input ends inside a frame,
* including empty input, or if data that is not a frame follows a frame.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createLz4DecompressStream(
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming brotli compression TransformStream with a custom dictionary.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked compression
* with a custom dictionary for improved compression of similar data.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param dict Custom dictionary bytes.
* @param quality Compression quality (0-11). Default is 6.
*/
export declare function createBrotliCompressDictStream(
dict: Buffer | Uint8Array,
quality?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming brotli decompression TransformStream with a custom dictionary.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked decompression
* with a custom dictionary. The same dictionary used for compression must be provided.
*
* The stream errors if the input ends before the compressed stream does,
* including empty input.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @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 createBrotliDecompressDictStream(
dict: Buffer | Uint8Array,
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming zstd compression TransformStream with a pre-trained dictionary.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked compression
* with a pre-trained dictionary for improved compression of small, similar data.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param dict Pre-trained dictionary (from `zstdTrainDictionary`).
* @param level Compression level (1-22, or negative for fast mode). Default is 3.
*/
export declare function createZstdCompressDictStream(
dict: Buffer | Uint8Array,
level?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming zstd decompression TransformStream with a pre-trained dictionary.
*
* Uses the Web Streams API (`TransformStream`) to provide chunked decompression
* with a pre-trained dictionary. The same dictionary used for compression must be provided.
*
* The stream errors if the input ends before the compressed stream does,
* including empty input.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param dict Pre-trained dictionary (must match the one used for compression).
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createZstdDecompressDictStream(
dict: Buffer | Uint8Array,
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;
/**
* Create a streaming auto-detect decompression TransformStream.
*
* 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 stream errors if the format is still
* unknown then.
*
* The stream errors on empty input, which has no format to detect, and on
* zstd, gzip or brotli input that ends before the compressed stream does.
*
* Input chunks may be any ArrayBuffer, SharedArrayBuffer or ArrayBufferView,
* read byte for byte: a `Uint16Array` is not converted element by element.
*
* @param maxOutputSize Maximum decompressed output size in bytes. Default is 256 MB.
*/
export declare function createDecompressStream(
maxOutputSize?: number,
): TransformStream<ArrayBufferLike | ArrayBufferView, Uint8Array>;