@types/three 0.149.0 → 0.150.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (103) hide show
  1. three/README.md +2 -2
  2. three/build/three.d.cts +2 -0
  3. three/build/three.d.ts +2 -0
  4. three/build/three.module.d.ts +2 -0
  5. three/examples/jsm/controls/OrbitControls.d.ts +5 -0
  6. three/examples/jsm/controls/TransformControls.d.ts +1 -5
  7. three/examples/jsm/geometries/TextGeometry.d.ts +92 -15
  8. three/examples/jsm/helpers/OctreeHelper.d.ts +1 -1
  9. three/examples/jsm/libs/fflate.module.d.ts +1 -0
  10. three/examples/jsm/libs/lil-gui.module.min.d.ts +1 -0
  11. three/examples/jsm/libs/stats.module.d.ts +2 -23
  12. three/examples/jsm/loaders/EXRLoader.d.ts +3 -2
  13. three/examples/jsm/misc/GPUComputationRenderer.d.ts +4 -2
  14. three/examples/jsm/nodes/shadernode/ShaderNode.d.ts +3 -4
  15. three/examples/jsm/objects/MarchingCubes.d.ts +1 -0
  16. three/examples/jsm/shaders/VelocityShader.d.ts +2 -2
  17. three/index.d.ts +1 -1
  18. three/package.json +19 -4
  19. three/src/Three.d.ts +0 -1
  20. three/src/audio/Audio.d.ts +184 -20
  21. three/src/audio/AudioAnalyser.d.ts +42 -4
  22. three/src/audio/AudioContext.d.ts +12 -1
  23. three/src/audio/AudioListener.d.ts +76 -8
  24. three/src/audio/PositionalAudio.d.ts +86 -5
  25. three/src/cameras/ArrayCamera.d.ts +23 -2
  26. three/src/cameras/Camera.d.ts +42 -13
  27. three/src/cameras/CubeCamera.d.ts +49 -1
  28. three/src/cameras/OrthographicCamera.d.ts +77 -25
  29. three/src/cameras/PerspectiveCamera.d.ts +132 -56
  30. three/src/cameras/StereoCamera.d.ts +29 -2
  31. three/src/constants.d.ts +790 -245
  32. three/src/core/BufferAttribute.d.ts +456 -85
  33. three/src/core/BufferGeometry.d.ts +237 -67
  34. three/src/core/Clock.d.ts +28 -20
  35. three/src/core/EventDispatcher.d.ts +20 -4
  36. three/src/core/GLBufferAttribute.d.ts +102 -8
  37. three/src/core/InstancedBufferAttribute.d.ts +13 -24
  38. three/src/core/InstancedBufferGeometry.d.ts +22 -4
  39. three/src/core/InstancedInterleavedBuffer.d.ts +10 -2
  40. three/src/core/InterleavedBuffer.d.ts +98 -14
  41. three/src/core/InterleavedBufferAttribute.d.ts +146 -7
  42. three/src/core/Layers.d.ts +61 -6
  43. three/src/core/Object3D.d.ts +244 -123
  44. three/src/core/Raycaster.d.ts +104 -27
  45. three/src/core/Uniform.d.ts +28 -11
  46. three/src/core/UniformsGroup.d.ts +10 -4
  47. three/src/extras/Earcut.d.ts +3 -4
  48. three/src/geometries/BoxGeometry.d.ts +39 -16
  49. three/src/geometries/CapsuleGeometry.d.ts +35 -12
  50. three/src/geometries/CircleGeometry.d.ts +38 -12
  51. three/src/geometries/ConeGeometry.d.ts +45 -10
  52. three/src/geometries/CylinderGeometry.d.ts +41 -19
  53. three/src/geometries/DodecahedronGeometry.d.ts +14 -5
  54. three/src/geometries/EdgesGeometry.d.ts +30 -8
  55. three/src/geometries/ExtrudeGeometry.d.ts +93 -12
  56. three/src/geometries/IcosahedronGeometry.d.ts +15 -5
  57. three/src/geometries/LatheGeometry.d.ts +41 -12
  58. three/src/geometries/OctahedronGeometry.d.ts +14 -5
  59. three/src/geometries/PlaneGeometry.d.ts +35 -12
  60. three/src/geometries/PolyhedronGeometry.d.ts +41 -12
  61. three/src/geometries/RingGeometry.d.ts +39 -16
  62. three/src/geometries/ShapeGeometry.d.ts +44 -4
  63. three/src/geometries/SphereGeometry.d.ts +43 -21
  64. three/src/geometries/TetrahedronGeometry.d.ts +14 -5
  65. three/src/geometries/TorusGeometry.d.ts +35 -13
  66. three/src/geometries/TorusKnotGeometry.d.ts +39 -16
  67. three/src/geometries/TubeGeometry.d.ts +63 -15
  68. three/src/geometries/WireframeGeometry.d.ts +30 -4
  69. three/src/materials/MeshPhysicalMaterial.d.ts +13 -1
  70. three/src/math/Color.d.ts +157 -3
  71. three/src/math/ColorManagement.d.ts +13 -7
  72. three/src/objects/Bone.d.ts +30 -3
  73. three/src/objects/Group.d.ts +37 -1
  74. three/src/objects/InstancedMesh.d.ts +122 -3
  75. three/src/objects/LOD.d.ts +62 -18
  76. three/src/objects/Line.d.ts +67 -4
  77. three/src/objects/LineLoop.d.ts +26 -1
  78. three/src/objects/LineSegments.d.ts +21 -9
  79. three/src/objects/Mesh.d.ts +60 -4
  80. three/src/objects/Points.d.ts +39 -8
  81. three/src/objects/Skeleton.d.ts +89 -3
  82. three/src/objects/SkinnedMesh.d.ts +122 -3
  83. three/src/objects/Sprite.d.ts +51 -4
  84. three/src/renderers/WebGLRenderTarget.d.ts +9 -3
  85. three/src/renderers/WebGLRenderer.d.ts +2 -2
  86. three/src/scenes/Fog.d.ts +59 -7
  87. three/src/scenes/FogExp2.d.ts +41 -6
  88. three/src/scenes/Scene.d.ts +45 -22
  89. three/src/textures/CanvasTexture.d.ts +35 -13
  90. three/src/textures/CompressedArrayTexture.d.ts +39 -5
  91. three/src/textures/CompressedTexture.d.ts +49 -20
  92. three/src/textures/CubeTexture.d.ts +71 -18
  93. three/src/textures/Data3DTexture.d.ts +74 -10
  94. three/src/textures/DataArrayTexture.d.ts +83 -9
  95. three/src/textures/DataTexture.d.ts +81 -26
  96. three/src/textures/DepthTexture.d.ts +71 -15
  97. three/src/textures/FramebufferTexture.d.ts +57 -2
  98. three/src/textures/Source.d.ts +23 -13
  99. three/src/textures/Texture.d.ts +289 -73
  100. three/src/textures/VideoTexture.d.ts +69 -13
  101. three/src/textures/types.d.ts +9 -0
  102. three/src/utils.d.ts +5 -2
  103. three/examples/jsm/libs/fflate.module.min.d.ts +0 -1185
@@ -1,1185 +0,0 @@
1
- /**
2
- * Options for compressing data into a DEFLATE format
3
- */
4
- export interface DeflateOptions {
5
- /**
6
- * The level of compression to use, ranging from 0-9.
7
- *
8
- * 0 will store the data without compression.
9
- * 1 is fastest but compresses the worst, 9 is slowest but compresses the best.
10
- * The default level is 6.
11
- *
12
- * Typically, binary data benefits much more from higher values than text data.
13
- * In both cases, higher values usually take disproportionately longer than the reduction in final size that results.
14
- *
15
- * For example, a 1 MB text file could:
16
- * - become 1.01 MB with level 0 in 1ms
17
- * - become 400 kB with level 1 in 10ms
18
- * - become 320 kB with level 9 in 100ms
19
- */
20
- level?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | undefined;
21
- /**
22
- * The memory level to use, ranging from 0-12. Increasing this increases speed and compression ratio at the cost of memory.
23
- *
24
- * Note that this is exponential: while level 0 uses 4 kB, level 4 uses 64 kB, level 8 uses 1 MB, and level 12 uses 16 MB.
25
- * It is recommended not to lower the value below 4, since that tends to hurt performance.
26
- * In addition, values above 8 tend to help very little on most data and can even hurt performance.
27
- *
28
- * The default value is automatically determined based on the size of the input data.
29
- */
30
- mem?: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | undefined;
31
- }
32
- /**
33
- * Options for compressing data into a GZIP format
34
- */
35
- export interface GzipOptions extends DeflateOptions {
36
- /**
37
- * When the file was last modified. Defaults to the current time.
38
- * Set this to 0 to avoid revealing a modification date entirely.
39
- */
40
- mtime?: Date | string | number | undefined;
41
- /**
42
- * The filename of the data. If the `gunzip` command is used to decompress the data, it will output a file
43
- * with this name instead of the name of the compressed file.
44
- */
45
- filename?: string | undefined;
46
- }
47
- /**
48
- * Options for compressing data into a Zlib format
49
- */
50
- export type ZlibOptions = DeflateOptions;
51
- /**
52
- * Handler for data (de)compression streams
53
- * @param data The data output from the stream processor
54
- * @param final Whether this is the final block
55
- */
56
- export type FlateStreamHandler = (data: Uint8Array, final: boolean) => void;
57
- /**
58
- * Handler for asynchronous data (de)compression streams
59
- * @param err Any error that occurred
60
- * @param data The data output from the stream processor
61
- * @param final Whether this is the final block
62
- */
63
- export type AsyncFlateStreamHandler = (err: Error, data: Uint8Array, final: boolean) => void;
64
- /**
65
- * Callback for asynchronous (de)compression methods
66
- * @param err Any error that occurred
67
- * @param data The resulting data. Only present if `err` is null
68
- */
69
- export type FlateCallback = (err: Error | string, data: Uint8Array) => void;
70
- interface AsyncOptions {
71
- /**
72
- * Whether or not to "consume" the source data. This will make the typed array/buffer you pass in
73
- * unusable but will increase performance and reduce memory usage.
74
- */
75
- consume?: boolean | undefined;
76
- }
77
- /**
78
- * Options for compressing data asynchronously into a DEFLATE format
79
- */
80
- export interface AsyncDeflateOptions extends DeflateOptions, AsyncOptions {}
81
- /**
82
- * Options for decompressing DEFLATE data asynchronously
83
- */
84
- export interface AsyncInflateOptions extends AsyncOptions {
85
- /**
86
- * The original size of the data. Currently, the asynchronous API disallows
87
- * writing into a buffer you provide; the best you can do is provide the
88
- * size in bytes and be given back a new typed array.
89
- */
90
- size?: number | undefined;
91
- }
92
- /**
93
- * Options for compressing data asynchronously into a GZIP format
94
- */
95
- export interface AsyncGzipOptions extends GzipOptions, AsyncOptions {}
96
- /**
97
- * Options for decompressing GZIP data asynchronously
98
- */
99
- export type AsyncGunzipOptions = AsyncOptions;
100
- /**
101
- * Options for compressing data asynchronously into a Zlib format
102
- */
103
- export interface AsyncZlibOptions extends ZlibOptions, AsyncOptions {}
104
- /**
105
- * Options for decompressing Zlib data asynchronously
106
- */
107
- export type AsyncUnzlibOptions = AsyncInflateOptions;
108
- /**
109
- * A terminable compression/decompression process
110
- */
111
- export interface AsyncTerminable {
112
- /**
113
- * Terminates the worker thread immediately. The callback will not be called.
114
- */
115
- (): void;
116
- }
117
- /**
118
- * Streaming DEFLATE compression
119
- */
120
- export class Deflate {
121
- /**
122
- * Creates a DEFLATE stream
123
- * @param opts The compression options
124
- * @param cb The callback to call whenever data is deflated
125
- */
126
- constructor(opts: DeflateOptions, cb?: FlateStreamHandler);
127
- constructor(cb?: FlateStreamHandler);
128
- private o;
129
- private d;
130
- /**
131
- * The handler to call whenever data is available
132
- */
133
- ondata: FlateStreamHandler;
134
- private p;
135
- /**
136
- * Pushes a chunk to be deflated
137
- * @param chunk The chunk to push
138
- * @param final Whether this is the last chunk
139
- */
140
- push(chunk: Uint8Array, final?: boolean): void;
141
- }
142
- /**
143
- * Asynchronous streaming DEFLATE compression
144
- */
145
- export class AsyncDeflate {
146
- /**
147
- * The handler to call whenever data is available
148
- */
149
- ondata: AsyncFlateStreamHandler;
150
- /**
151
- * Creates an asynchronous DEFLATE stream
152
- * @param opts The compression options
153
- * @param cb The callback to call whenever data is deflated
154
- */
155
- constructor(opts: DeflateOptions, cb?: AsyncFlateStreamHandler);
156
- /**
157
- * Creates an asynchronous DEFLATE stream
158
- * @param cb The callback to call whenever data is deflated
159
- */
160
- constructor(cb?: AsyncFlateStreamHandler);
161
- /**
162
- * Pushes a chunk to be deflated
163
- * @param chunk The chunk to push
164
- * @param final Whether this is the last chunk
165
- */
166
- push(chunk: Uint8Array, final?: boolean): void;
167
- /**
168
- * A method to terminate the stream's internal worker. Subsequent calls to
169
- * push() will silently fail.
170
- */
171
- terminate: AsyncTerminable;
172
- }
173
- /**
174
- * Asynchronously compresses data with DEFLATE without any wrapper
175
- * @param data The data to compress
176
- * @param opts The compression options
177
- * @param cb The function to be called upon compression completion
178
- * @returns A function that can be used to immediately terminate the compression
179
- */
180
- export function deflate(data: Uint8Array, opts: AsyncDeflateOptions, cb: FlateCallback): AsyncTerminable;
181
- /**
182
- * Asynchronously compresses data with DEFLATE without any wrapper
183
- * @param data The data to compress
184
- * @param cb The function to be called upon compression completion
185
- */
186
- export function deflate(data: Uint8Array, cb: FlateCallback): AsyncTerminable;
187
- /**
188
- * Compresses data with DEFLATE without any wrapper
189
- * @param data The data to compress
190
- * @param opts The compression options
191
- * @returns The deflated version of the data
192
- */
193
- export function deflateSync(data: Uint8Array, opts?: DeflateOptions): Uint8Array;
194
- /**
195
- * Streaming DEFLATE decompression
196
- */
197
- export class Inflate {
198
- /**
199
- * Creates an inflation stream
200
- * @param cb The callback to call whenever data is inflated
201
- */
202
- constructor(cb?: FlateStreamHandler);
203
- private s;
204
- private o;
205
- private p;
206
- private d;
207
- /**
208
- * The handler to call whenever data is available
209
- */
210
- ondata: FlateStreamHandler;
211
- private e;
212
- private c;
213
- /**
214
- * Pushes a chunk to be inflated
215
- * @param chunk The chunk to push
216
- * @param final Whether this is the final chunk
217
- */
218
- push(chunk: Uint8Array, final?: boolean): void;
219
- }
220
- /**
221
- * Asynchronous streaming DEFLATE decompression
222
- */
223
- export class AsyncInflate {
224
- /**
225
- * The handler to call whenever data is available
226
- */
227
- ondata: AsyncFlateStreamHandler;
228
- /**
229
- * Creates an asynchronous inflation stream
230
- * @param cb The callback to call whenever data is deflated
231
- */
232
- constructor(cb?: AsyncFlateStreamHandler);
233
- /**
234
- * Pushes a chunk to be inflated
235
- * @param chunk The chunk to push
236
- * @param final Whether this is the last chunk
237
- */
238
- push(chunk: Uint8Array, final?: boolean): void;
239
- /**
240
- * A method to terminate the stream's internal worker. Subsequent calls to
241
- * push() will silently fail.
242
- */
243
- terminate: AsyncTerminable;
244
- }
245
- /**
246
- * Asynchronously expands DEFLATE data with no wrapper
247
- * @param data The data to decompress
248
- * @param opts The decompression options
249
- * @param cb The function to be called upon decompression completion
250
- * @returns A function that can be used to immediately terminate the decompression
251
- */
252
- export function inflate(data: Uint8Array, opts: AsyncInflateOptions, cb: FlateCallback): AsyncTerminable;
253
- /**
254
- * Asynchronously expands DEFLATE data with no wrapper
255
- * @param data The data to decompress
256
- * @param cb The function to be called upon decompression completion
257
- * @returns A function that can be used to immediately terminate the decompression
258
- */
259
- export function inflate(data: Uint8Array, cb: FlateCallback): AsyncTerminable;
260
- /**
261
- * Expands DEFLATE data with no wrapper
262
- * @param data The data to decompress
263
- * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
264
- * @returns The decompressed version of the data
265
- */
266
- export function inflateSync(data: Uint8Array, out?: Uint8Array): Uint8Array;
267
- /**
268
- * Streaming GZIP compression
269
- */
270
- export class Gzip {
271
- private c;
272
- private l;
273
- private v;
274
- private o;
275
- /**
276
- * The handler to call whenever data is available
277
- */
278
- ondata: FlateStreamHandler;
279
- /**
280
- * Creates a GZIP stream
281
- * @param opts The compression options
282
- * @param cb The callback to call whenever data is deflated
283
- */
284
- constructor(opts: GzipOptions, cb?: FlateStreamHandler);
285
- /**
286
- * Creates a GZIP stream
287
- * @param cb The callback to call whenever data is deflated
288
- */
289
- constructor(cb?: FlateStreamHandler);
290
- /**
291
- * Pushes a chunk to be GZIPped
292
- * @param chunk The chunk to push
293
- * @param final Whether this is the last chunk
294
- */
295
- push(chunk: Uint8Array, final?: boolean): void;
296
- private p;
297
- }
298
- /**
299
- * Asynchronous streaming GZIP compression
300
- */
301
- export class AsyncGzip {
302
- /**
303
- * The handler to call whenever data is available
304
- */
305
- ondata: AsyncFlateStreamHandler;
306
- /**
307
- * Creates an asynchronous GZIP stream
308
- * @param opts The compression options
309
- * @param cb The callback to call whenever data is deflated
310
- */
311
- constructor(opts: GzipOptions, cb?: AsyncFlateStreamHandler);
312
- /**
313
- * Creates an asynchronous GZIP stream
314
- * @param cb The callback to call whenever data is deflated
315
- */
316
- constructor(cb?: AsyncFlateStreamHandler);
317
- /**
318
- * Pushes a chunk to be GZIPped
319
- * @param chunk The chunk to push
320
- * @param final Whether this is the last chunk
321
- */
322
- push(chunk: Uint8Array, final?: boolean): void;
323
- /**
324
- * A method to terminate the stream's internal worker. Subsequent calls to
325
- * push() will silently fail.
326
- */
327
- terminate: AsyncTerminable;
328
- }
329
- /**
330
- * Asynchronously compresses data with GZIP
331
- * @param data The data to compress
332
- * @param opts The compression options
333
- * @param cb The function to be called upon compression completion
334
- * @returns A function that can be used to immediately terminate the compression
335
- */
336
- export function gzip(data: Uint8Array, opts: AsyncGzipOptions, cb: FlateCallback): AsyncTerminable;
337
- /**
338
- * Asynchronously compresses data with GZIP
339
- * @param data The data to compress
340
- * @param cb The function to be called upon compression completion
341
- * @returns A function that can be used to immediately terminate the decompression
342
- */
343
- export function gzip(data: Uint8Array, cb: FlateCallback): AsyncTerminable;
344
- /**
345
- * Compresses data with GZIP
346
- * @param data The data to compress
347
- * @param opts The compression options
348
- * @returns The gzipped version of the data
349
- */
350
- export function gzipSync(data: Uint8Array, opts?: GzipOptions): Uint8Array;
351
- /**
352
- * Streaming GZIP decompression
353
- */
354
- export class Gunzip {
355
- private v;
356
- private p;
357
- /**
358
- * The handler to call whenever data is available
359
- */
360
- ondata: FlateStreamHandler;
361
- /**
362
- * Creates a GUNZIP stream
363
- * @param cb The callback to call whenever data is inflated
364
- */
365
- constructor(cb?: FlateStreamHandler);
366
- /**
367
- * Pushes a chunk to be GUNZIPped
368
- * @param chunk The chunk to push
369
- * @param final Whether this is the last chunk
370
- */
371
- push(chunk: Uint8Array, final?: boolean): void;
372
- }
373
- /**
374
- * Asynchronous streaming GZIP decompression
375
- */
376
- export class AsyncGunzip {
377
- /**
378
- * The handler to call whenever data is available
379
- */
380
- ondata: AsyncFlateStreamHandler;
381
- /**
382
- * Creates an asynchronous GUNZIP stream
383
- * @param cb The callback to call whenever data is deflated
384
- */
385
- constructor(cb: AsyncFlateStreamHandler);
386
- /**
387
- * Pushes a chunk to be GUNZIPped
388
- * @param chunk The chunk to push
389
- * @param final Whether this is the last chunk
390
- */
391
- push(chunk: Uint8Array, final?: boolean): void;
392
- /**
393
- * A method to terminate the stream's internal worker. Subsequent calls to
394
- * push() will silently fail.
395
- */
396
- terminate: AsyncTerminable;
397
- }
398
- /**
399
- * Asynchronously expands GZIP data
400
- * @param data The data to decompress
401
- * @param opts The decompression options
402
- * @param cb The function to be called upon decompression completion
403
- * @returns A function that can be used to immediately terminate the decompression
404
- */
405
- export function gunzip(data: Uint8Array, opts: AsyncGunzipOptions, cb: FlateCallback): AsyncTerminable;
406
- /**
407
- * Asynchronously expands GZIP data
408
- * @param data The data to decompress
409
- * @param cb The function to be called upon decompression completion
410
- * @returns A function that can be used to immediately terminate the decompression
411
- */
412
- export function gunzip(data: Uint8Array, cb: FlateCallback): AsyncTerminable;
413
- /**
414
- * Expands GZIP data
415
- * @param data The data to decompress
416
- * @param out Where to write the data. GZIP already encodes the output size, so providing this doesn't save memory.
417
- * @returns The decompressed version of the data
418
- */
419
- export function gunzipSync(data: Uint8Array, out?: Uint8Array): Uint8Array;
420
- /**
421
- * Streaming Zlib compression
422
- */
423
- export class Zlib {
424
- private c;
425
- private v;
426
- private o;
427
- /**
428
- * The handler to call whenever data is available
429
- */
430
- ondata: FlateStreamHandler;
431
- /**
432
- * Creates a Zlib stream
433
- * @param opts The compression options
434
- * @param cb The callback to call whenever data is deflated
435
- */
436
- constructor(opts: ZlibOptions, cb?: FlateStreamHandler);
437
- /**
438
- * Creates a Zlib stream
439
- * @param cb The callback to call whenever data is deflated
440
- */
441
- constructor(cb?: FlateStreamHandler);
442
- /**
443
- * Pushes a chunk to be zlibbed
444
- * @param chunk The chunk to push
445
- * @param final Whether this is the last chunk
446
- */
447
- push(chunk: Uint8Array, final?: boolean): void;
448
- private p;
449
- }
450
- /**
451
- * Asynchronous streaming Zlib compression
452
- */
453
- export class AsyncZlib {
454
- /**
455
- * The handler to call whenever data is available
456
- */
457
- ondata: AsyncFlateStreamHandler;
458
- /**
459
- * Creates an asynchronous DEFLATE stream
460
- * @param opts The compression options
461
- * @param cb The callback to call whenever data is deflated
462
- */
463
- constructor(opts: ZlibOptions, cb?: AsyncFlateStreamHandler);
464
- /**
465
- * Creates an asynchronous DEFLATE stream
466
- * @param cb The callback to call whenever data is deflated
467
- */
468
- constructor(cb?: AsyncFlateStreamHandler);
469
- /**
470
- * Pushes a chunk to be deflated
471
- * @param chunk The chunk to push
472
- * @param final Whether this is the last chunk
473
- */
474
- push(chunk: Uint8Array, final?: boolean): void;
475
- /**
476
- * A method to terminate the stream's internal worker. Subsequent calls to
477
- * push() will silently fail.
478
- */
479
- terminate: AsyncTerminable;
480
- }
481
- /**
482
- * Asynchronously compresses data with Zlib
483
- * @param data The data to compress
484
- * @param opts The compression options
485
- * @param cb The function to be called upon compression completion
486
- */
487
- export function zlib(data: Uint8Array, opts: AsyncZlibOptions, cb: FlateCallback): AsyncTerminable;
488
- /**
489
- * Asynchronously compresses data with Zlib
490
- * @param data The data to compress
491
- * @param cb The function to be called upon compression completion
492
- * @returns A function that can be used to immediately terminate the compression
493
- */
494
- export function zlib(data: Uint8Array, cb: FlateCallback): AsyncTerminable;
495
- /**
496
- * Compress data with Zlib
497
- * @param data The data to compress
498
- * @param opts The compression options
499
- * @returns The zlib-compressed version of the data
500
- */
501
- export function zlibSync(data: Uint8Array, opts: ZlibOptions): Uint8Array;
502
- /**
503
- * Streaming Zlib decompression
504
- */
505
- export class Unzlib {
506
- private v;
507
- private p;
508
- /**
509
- * The handler to call whenever data is available
510
- */
511
- ondata: FlateStreamHandler;
512
- /**
513
- * Creates a Zlib decompression stream
514
- * @param cb The callback to call whenever data is inflated
515
- */
516
- constructor(cb?: FlateStreamHandler);
517
- /**
518
- * Pushes a chunk to be unzlibbed
519
- * @param chunk The chunk to push
520
- * @param final Whether this is the last chunk
521
- */
522
- push(chunk: Uint8Array, final?: boolean): void;
523
- }
524
- /**
525
- * Asynchronous streaming Zlib decompression
526
- */
527
- export class AsyncUnzlib {
528
- /**
529
- * The handler to call whenever data is available
530
- */
531
- ondata: AsyncFlateStreamHandler;
532
- /**
533
- * Creates an asynchronous Zlib decompression stream
534
- * @param cb The callback to call whenever data is deflated
535
- */
536
- constructor(cb?: AsyncFlateStreamHandler);
537
- /**
538
- * Pushes a chunk to be decompressed from Zlib
539
- * @param chunk The chunk to push
540
- * @param final Whether this is the last chunk
541
- */
542
- push(chunk: Uint8Array, final?: boolean): void;
543
- /**
544
- * A method to terminate the stream's internal worker. Subsequent calls to
545
- * push() will silently fail.
546
- */
547
- terminate: AsyncTerminable;
548
- }
549
- /**
550
- * Asynchronously expands Zlib data
551
- * @param data The data to decompress
552
- * @param opts The decompression options
553
- * @param cb The function to be called upon decompression completion
554
- * @returns A function that can be used to immediately terminate the decompression
555
- */
556
- export function unzlib(data: Uint8Array, opts: AsyncGunzipOptions, cb: FlateCallback): AsyncTerminable;
557
- /**
558
- * Asynchronously expands Zlib data
559
- * @param data The data to decompress
560
- * @param cb The function to be called upon decompression completion
561
- * @returns A function that can be used to immediately terminate the decompression
562
- */
563
- export function unzlib(data: Uint8Array, cb: FlateCallback): AsyncTerminable;
564
- /**
565
- * Expands Zlib data
566
- * @param data The data to decompress
567
- * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
568
- * @returns The decompressed version of the data
569
- */
570
- export function unzlibSync(data: Uint8Array, out?: Uint8Array): Uint8Array;
571
- export { gzip as compress, AsyncGzip as AsyncCompress };
572
- export { gzipSync as compressSync, Gzip as Compress };
573
- /**
574
- * Streaming GZIP, Zlib, or raw DEFLATE decompression
575
- */
576
- export class Decompress {
577
- private G;
578
- private I;
579
- private Z;
580
- /**
581
- * Creates a decompression stream
582
- * @param cb The callback to call whenever data is decompressed
583
- */
584
- constructor(cb?: FlateStreamHandler);
585
- private s;
586
- /**
587
- * The handler to call whenever data is available
588
- */
589
- ondata: FlateStreamHandler;
590
- private p;
591
- /**
592
- * Pushes a chunk to be decompressed
593
- * @param chunk The chunk to push
594
- * @param final Whether this is the last chunk
595
- */
596
- push(chunk: Uint8Array, final?: boolean): void;
597
- }
598
- /**
599
- * Asynchronous streaming GZIP, Zlib, or raw DEFLATE decompression
600
- */
601
- export class AsyncDecompress {
602
- private G;
603
- private I;
604
- private Z;
605
- /**
606
- * Creates an asynchronous decompression stream
607
- * @param cb The callback to call whenever data is decompressed
608
- */
609
- constructor(cb?: AsyncFlateStreamHandler);
610
- /**
611
- * The handler to call whenever data is available
612
- */
613
- ondata: AsyncFlateStreamHandler;
614
- /**
615
- * Pushes a chunk to be decompressed
616
- * @param chunk The chunk to push
617
- * @param final Whether this is the last chunk
618
- */
619
- push(chunk: Uint8Array, final?: boolean): void;
620
- }
621
- /**
622
- * Asynchrononously expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format
623
- * @param data The data to decompress
624
- * @param opts The decompression options
625
- * @param cb The function to be called upon decompression completion
626
- * @returns A function that can be used to immediately terminate the decompression
627
- */
628
- export function decompress(data: Uint8Array, opts: AsyncInflateOptions, cb: FlateCallback): AsyncTerminable;
629
- /**
630
- * Asynchrononously expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format
631
- * @param data The data to decompress
632
- * @param cb The function to be called upon decompression completion
633
- * @returns A function that can be used to immediately terminate the decompression
634
- */
635
- export function decompress(data: Uint8Array, cb: FlateCallback): AsyncTerminable;
636
- /**
637
- * Expands compressed GZIP, Zlib, or raw DEFLATE data, automatically detecting the format
638
- * @param data The data to decompress
639
- * @param out Where to write the data. Saves memory if you know the decompressed size and provide an output buffer of that length.
640
- * @returns The decompressed version of the data
641
- */
642
- export function decompressSync(data: Uint8Array, out?: Uint8Array): Uint8Array;
643
- /**
644
- * Attributes for files added to a ZIP archive object
645
- */
646
- export interface ZipAttributes {
647
- /**
648
- * The operating system of origin for this file. The value is defined
649
- * by PKZIP's APPNOTE.txt, section 4.4.2.2. For example, 0 (the default)
650
- * is MS/DOS, 3 is UNIX, 19 is macOS.
651
- */
652
- os?: number | undefined;
653
- /**
654
- * The file's attributes. These are traditionally somewhat complicated
655
- * and platform-dependent, so using them is scarcely necessary. However,
656
- * here is a representation of what this is, bit by bit:
657
- *
658
- * `TTTTugtrwxrwxrwx0000000000ADVSHR`
659
- *
660
- * TTTT = file type (rarely useful)
661
- *
662
- * u = setuid, g = setgid, t = sticky
663
- *
664
- * rwx = user permissions, rwx = group permissions, rwx = other permissions
665
- *
666
- * 0000000000 = unused
667
- *
668
- * A = archive, D = directory, V = volume label, S = system file, H = hidden, R = read-only
669
- *
670
- * If you want to set the Unix permissions, for instance, just bit shift by 16, e.g. 0644 << 16
671
- */
672
- attrs?: number | undefined;
673
- /**
674
- * Extra metadata to add to the file. This field is defined by PKZIP's APPNOTE.txt,
675
- * section 4.4.28. At most 65,535 bytes may be used in each ID. The ID must be an
676
- * integer between 0 and 65,535, inclusive.
677
- *
678
- * This field is incredibly rare and almost never needed except for compliance with
679
- * proprietary standards and software.
680
- */
681
- extra?: Record<number, Uint8Array> | undefined;
682
- /**
683
- * The comment to attach to the file. This field is defined by PKZIP's APPNOTE.txt,
684
- * section 4.4.26. The comment must be at most 65,535 bytes long UTF-8 encoded. This
685
- * field is not read by consumer software.
686
- */
687
- comment?: string | undefined;
688
- /**
689
- * When the file was last modified. Defaults to the current time.
690
- */
691
- mtime?: GzipOptions['mtime'] | undefined;
692
- }
693
- /**
694
- * Options for creating a ZIP archive
695
- */
696
- export interface ZipOptions extends DeflateOptions, ZipAttributes {}
697
- /**
698
- * Options for asynchronously creating a ZIP archive
699
- */
700
- export interface AsyncZipOptions extends AsyncDeflateOptions, ZipAttributes {}
701
- /**
702
- * Options for asynchronously expanding a ZIP archive
703
- */
704
- export type AsyncUnzipOptions = AsyncOptions;
705
- /**
706
- * A file that can be used to create a ZIP archive
707
- */
708
- export type ZippableFile = Uint8Array | [Uint8Array, ZipOptions];
709
- /**
710
- * A file that can be used to asynchronously create a ZIP archive
711
- */
712
- export type AsyncZippableFile = Uint8Array | [Uint8Array, AsyncZipOptions];
713
- /**
714
- * The complete directory structure of a ZIPpable archive
715
- */
716
- export interface Zippable {
717
- [path: string]: Zippable | ZippableFile;
718
- }
719
- /**
720
- * The complete directory structure of an asynchronously ZIPpable archive
721
- */
722
- export interface AsyncZippable {
723
- [path: string]: AsyncZippable | AsyncZippableFile;
724
- }
725
- /**
726
- * An unzipped archive. The full path of each file is used as the key,
727
- * and the file is the value
728
- */
729
- export interface Unzipped {
730
- [path: string]: Uint8Array;
731
- }
732
- /**
733
- * Handler for string generation streams
734
- * @param data The string output from the stream processor
735
- * @param final Whether this is the final block
736
- */
737
- export type StringStreamHandler = (data: string, final: boolean) => void;
738
- /**
739
- * Callback for asynchronous ZIP decompression
740
- * @param err Any error that occurred
741
- * @param data The decompressed ZIP archive
742
- */
743
- export type UnzipCallback = (err: Error | string, data: Unzipped) => void;
744
- /**
745
- * Handler for streaming ZIP decompression
746
- * @param file The file that was found in the archive
747
- */
748
- export type UnzipFileHandler = (file: UnzipFile) => void;
749
- /**
750
- * Streaming UTF-8 decoding
751
- */
752
- export class DecodeUTF8 {
753
- private p;
754
- private t;
755
- /**
756
- * Creates a UTF-8 decoding stream
757
- * @param cb The callback to call whenever data is decoded
758
- */
759
- constructor(cb?: StringStreamHandler);
760
- /**
761
- * Pushes a chunk to be decoded from UTF-8 binary
762
- * @param chunk The chunk to push
763
- * @param final Whether this is the last chunk
764
- */
765
- push(chunk: Uint8Array, final?: boolean): void;
766
- /**
767
- * The handler to call whenever data is available
768
- */
769
- ondata: StringStreamHandler;
770
- }
771
- /**
772
- * Streaming UTF-8 encoding
773
- */
774
- export class EncodeUTF8 {
775
- /**
776
- * Creates a UTF-8 decoding stream
777
- * @param cb The callback to call whenever data is encoded
778
- */
779
- constructor(cb?: FlateStreamHandler);
780
- /**
781
- * Pushes a chunk to be encoded to UTF-8
782
- * @param chunk The string data to push
783
- * @param final Whether this is the last chunk
784
- */
785
- push(chunk: string, final?: boolean): void;
786
- /**
787
- * The handler to call whenever data is available
788
- */
789
- ondata: FlateStreamHandler;
790
- }
791
- /**
792
- * Converts a string into a Uint8Array for use with compression/decompression methods
793
- * @param str The string to encode
794
- * @param latin1 Whether or not to interpret the data as Latin-1. This should
795
- * not need to be true unless decoding a binary string.
796
- * @returns The string encoded in UTF-8/Latin-1 binary
797
- */
798
- export function strToU8(str: string, latin1?: boolean): Uint8Array;
799
- /**
800
- * Converts a Uint8Array to a string
801
- * @param dat The data to decode to string
802
- * @param latin1 Whether or not to interpret the data as Latin-1. This should
803
- * not need to be true unless encoding to binary string.
804
- * @returns The original UTF-8/Latin-1 string
805
- */
806
- export function strFromU8(dat: Uint8Array, latin1?: boolean): string;
807
- /**
808
- * A stream that can be used to create a file in a ZIP archive
809
- */
810
- export interface ZipInputFile extends ZipAttributes {
811
- /**
812
- * The filename to associate with the data provided to this stream. If you
813
- * want a file in a subdirectory, use forward slashes as a separator (e.g.
814
- * `directory/filename.ext`). This will still work on Windows.
815
- */
816
- filename: string;
817
- /**
818
- * The size of the file in bytes. This attribute may be invalid after
819
- * the file is added to the ZIP archive; it must be correct only before the
820
- * stream completes.
821
- *
822
- * If you don't want to have to compute this yourself, consider extending the
823
- * ZipPassThrough class and overriding its process() method, or using one of
824
- * ZipDeflate or AsyncZipDeflate.
825
- */
826
- size: number;
827
- /**
828
- * A CRC of the original file contents. This attribute may be invalid after
829
- * the file is added to the ZIP archive; it must be correct only before the
830
- * stream completes.
831
- *
832
- * If you don't want to have to generate this yourself, consider extending the
833
- * ZipPassThrough class and overriding its process() method, or using one of
834
- * ZipDeflate or AsyncZipDeflate.
835
- */
836
- crc: number;
837
- /**
838
- * The compression format for the data stream. This number is determined by
839
- * the spec in PKZIP's APPNOTE.txt, section 4.4.5. For example, 0 = no
840
- * compression, 8 = deflate, 14 = LZMA
841
- */
842
- compression: number;
843
- /**
844
- * Bits 1 and 2 of the general purpose bit flag, specified in PKZIP's
845
- * APPNOTE.txt, section 4.4.4. Should be between 0 and 3. This is unlikely
846
- * to be necessary.
847
- */
848
- flag?: number | undefined;
849
- /**
850
- * The handler to be called when data is added. After passing this stream to
851
- * the ZIP file object, this handler will always be defined. To call it:
852
- *
853
- * `stream.ondata(error, chunk, final)`
854
- *
855
- * error = any error that occurred (null if there was no error)
856
- *
857
- * chunk = a Uint8Array of the data that was added (null if there was an
858
- * error)
859
- *
860
- * final = boolean, whether this is the final chunk in the stream
861
- */
862
- ondata?: AsyncFlateStreamHandler | undefined;
863
- /**
864
- * A method called when the stream is no longer needed, for clean-up
865
- * purposes. This will not always be called after the stream completes,
866
- * so you may wish to call this.terminate() after the final chunk is
867
- * processed if you have clean-up logic.
868
- */
869
- terminate?: AsyncTerminable | undefined;
870
- }
871
- /**
872
- * A pass-through stream to keep data uncompressed in a ZIP archive.
873
- */
874
- export class ZipPassThrough implements ZipInputFile {
875
- filename: string;
876
- crc: number;
877
- size: number;
878
- compression: number;
879
- os?: number | undefined;
880
- attrs?: number | undefined;
881
- comment?: string | undefined;
882
- extra?: Record<number, Uint8Array> | undefined;
883
- mtime?: GzipOptions['mtime'] | undefined;
884
- ondata: AsyncFlateStreamHandler;
885
- private c;
886
- /**
887
- * Creates a pass-through stream that can be added to ZIP archives
888
- * @param filename The filename to associate with this data stream
889
- */
890
- constructor(filename: string);
891
- /**
892
- * Processes a chunk and pushes to the output stream. You can override this
893
- * method in a subclass for custom behavior, but by default this passes
894
- * the data through. You must call this.ondata(err, chunk, final) at some
895
- * point in this method.
896
- * @param chunk The chunk to process
897
- * @param final Whether this is the last chunk
898
- */
899
- protected process(chunk: Uint8Array, final: boolean): void;
900
- /**
901
- * Pushes a chunk to be added. If you are subclassing this with a custom
902
- * compression algorithm, note that you must push data from the source
903
- * file only, pre-compression.
904
- * @param chunk The chunk to push
905
- * @param final Whether this is the last chunk
906
- */
907
- push(chunk: Uint8Array, final?: boolean): void;
908
- }
909
- /**
910
- * Streaming DEFLATE compression for ZIP archives. Prefer using AsyncZipDeflate
911
- * for better performance
912
- */
913
- export class ZipDeflate implements ZipInputFile {
914
- filename: string;
915
- crc: number;
916
- size: number;
917
- compression: number;
918
- flag: 0 | 1 | 2 | 3;
919
- os?: number | undefined;
920
- attrs?: number | undefined;
921
- comment?: string | undefined;
922
- extra?: Record<number, Uint8Array> | undefined;
923
- mtime?: GzipOptions['mtime'] | undefined;
924
- ondata: AsyncFlateStreamHandler;
925
- private d;
926
- /**
927
- * Creates a DEFLATE stream that can be added to ZIP archives
928
- * @param filename The filename to associate with this data stream
929
- * @param opts The compression options
930
- */
931
- constructor(filename: string, opts?: DeflateOptions);
932
- process(chunk: Uint8Array, final: boolean): void;
933
- /**
934
- * Pushes a chunk to be deflated
935
- * @param chunk The chunk to push
936
- * @param final Whether this is the last chunk
937
- */
938
- push(chunk: Uint8Array, final?: boolean): void;
939
- }
940
- /**
941
- * Asynchronous streaming DEFLATE compression for ZIP archives
942
- */
943
- export class AsyncZipDeflate implements ZipInputFile {
944
- filename: string;
945
- crc: number;
946
- size: number;
947
- compression: number;
948
- flag: 0 | 1 | 2 | 3;
949
- os?: number | undefined;
950
- attrs?: number | undefined;
951
- comment?: string | undefined;
952
- extra?: Record<number, Uint8Array> | undefined;
953
- mtime?: GzipOptions['mtime'] | undefined;
954
- ondata: AsyncFlateStreamHandler;
955
- private d;
956
- terminate: AsyncTerminable;
957
- /**
958
- * Creates a DEFLATE stream that can be added to ZIP archives
959
- * @param filename The filename to associate with this data stream
960
- * @param opts The compression options
961
- */
962
- constructor(filename: string, opts?: DeflateOptions);
963
- process(chunk: Uint8Array, final: boolean): void;
964
- /**
965
- * Pushes a chunk to be deflated
966
- * @param chunk The chunk to push
967
- * @param final Whether this is the last chunk
968
- */
969
- push(chunk: Uint8Array, final?: boolean): void;
970
- }
971
- /**
972
- * A zippable archive to which files can incrementally be added
973
- */
974
- export class Zip {
975
- private u;
976
- private d;
977
- /**
978
- * Creates an empty ZIP archive to which files can be added
979
- * @param cb The callback to call whenever data for the generated ZIP archive
980
- * is available
981
- */
982
- constructor(cb?: AsyncFlateStreamHandler);
983
- /**
984
- * Adds a file to the ZIP archive
985
- * @param file The file stream to add
986
- */
987
- add(file: ZipInputFile): void;
988
- /**
989
- * Ends the process of adding files and prepares to emit the final chunks.
990
- * This *must* be called after adding all desired files for the resulting
991
- * ZIP file to work properly.
992
- */
993
- end(): void;
994
- private e;
995
- /**
996
- * A method to terminate any internal workers used by the stream. Subsequent
997
- * calls to add() will fail.
998
- */
999
- terminate(): void;
1000
- /**
1001
- * The handler to call whenever data is available
1002
- */
1003
- ondata: AsyncFlateStreamHandler;
1004
- }
1005
- /**
1006
- * Asynchronously creates a ZIP file
1007
- * @param data The directory structure for the ZIP archive
1008
- * @param opts The main options, merged with per-file options
1009
- * @param cb The callback to call with the generated ZIP archive
1010
- * @returns A function that can be used to immediately terminate the compression
1011
- */
1012
- export function zip(data: AsyncZippable, opts: AsyncZipOptions, cb: FlateCallback): AsyncTerminable;
1013
- /**
1014
- * Asynchronously creates a ZIP file
1015
- * @param data The directory structure for the ZIP archive
1016
- * @param cb The callback to call with the generated ZIP archive
1017
- * @returns A function that can be used to immediately terminate the compression
1018
- */
1019
- export function zip(data: AsyncZippable, cb: FlateCallback): AsyncTerminable;
1020
- /**
1021
- * Synchronously creates a ZIP file. Prefer using `zip` for better performance
1022
- * with more than one file.
1023
- * @param data The directory structure for the ZIP archive
1024
- * @param opts The main options, merged with per-file options
1025
- * @returns The generated ZIP archive
1026
- */
1027
- export function zipSync(data: Zippable, opts?: ZipOptions): Uint8Array;
1028
- /**
1029
- * A decoder for files in ZIP streams
1030
- */
1031
- export interface UnzipDecoder {
1032
- /**
1033
- * The handler to call whenever data is available
1034
- */
1035
- ondata: AsyncFlateStreamHandler;
1036
- /**
1037
- * Pushes a chunk to be decompressed
1038
- * @param data The data in this chunk. Do not consume (detach) this data.
1039
- * @param final Whether this is the last chunk in the data stream
1040
- */
1041
- push(data: Uint8Array, final: boolean): void;
1042
- /**
1043
- * A method to terminate any internal workers used by the stream. Subsequent
1044
- * calls to push() should silently fail.
1045
- */
1046
- terminate?: AsyncTerminable | undefined;
1047
- }
1048
- /**
1049
- * A constructor for a decoder for unzip streams
1050
- */
1051
- export interface UnzipDecoderConstructor {
1052
- /**
1053
- * Creates an instance of the decoder
1054
- * @param filename The name of the file
1055
- * @param size The compressed size of the file
1056
- * @param originalSize The original size of the file
1057
- */
1058
- new (filename: string, size?: number, originalSize?: number): UnzipDecoder;
1059
- /**
1060
- * The compression format for the data stream. This number is determined by
1061
- * the spec in PKZIP's APPNOTE.txt, section 4.4.5. For example, 0 = no
1062
- * compression, 8 = deflate, 14 = LZMA
1063
- */
1064
- compression: number;
1065
- }
1066
- /**
1067
- * Streaming file extraction from ZIP archives
1068
- */
1069
- export interface UnzipFile {
1070
- /**
1071
- * The handler to call whenever data is available
1072
- */
1073
- ondata: AsyncFlateStreamHandler;
1074
- /**
1075
- * The name of the file
1076
- */
1077
- name: string;
1078
- /**
1079
- * The compression format for the data stream. This number is determined by
1080
- * the spec in PKZIP's APPNOTE.txt, section 4.4.5. For example, 0 = no
1081
- * compression, 8 = deflate, 14 = LZMA. If start() is called but there is no
1082
- * decompression stream available for this method, start() will throw.
1083
- */
1084
- compression: number;
1085
- /**
1086
- * The compressed size of the file
1087
- */
1088
- size?: number | undefined;
1089
- /**
1090
- * The original size of the file
1091
- */
1092
- originalSize?: number | undefined;
1093
- /**
1094
- * Starts reading from the stream. Calling this function will always enable
1095
- * this stream, but ocassionally the stream will be enabled even without
1096
- * this being called.
1097
- */
1098
- start(): void;
1099
- /**
1100
- * A method to terminate any internal workers used by the stream. ondata
1101
- * will not be called any further.
1102
- */
1103
- terminate: AsyncTerminable;
1104
- }
1105
- /**
1106
- * Streaming pass-through decompression for ZIP archives
1107
- */
1108
- export class UnzipPassThrough implements UnzipDecoder {
1109
- static compression: number;
1110
- ondata: AsyncFlateStreamHandler;
1111
- push(data: Uint8Array, final: boolean): void;
1112
- }
1113
- /**
1114
- * Streaming DEFLATE decompression for ZIP archives. Prefer AsyncZipInflate for
1115
- * better performance.
1116
- */
1117
- export class UnzipInflate implements UnzipDecoder {
1118
- static compression: number;
1119
- private i;
1120
- ondata: AsyncFlateStreamHandler;
1121
- /**
1122
- * Creates a DEFLATE decompression that can be used in ZIP archives
1123
- */
1124
- constructor();
1125
- push(data: Uint8Array, final: boolean): void;
1126
- }
1127
- /**
1128
- * Asynchronous streaming DEFLATE decompression for ZIP archives
1129
- */
1130
- export class AsyncUnzipInflate implements UnzipDecoder {
1131
- static compression: number;
1132
- private i;
1133
- ondata: AsyncFlateStreamHandler;
1134
- terminate: AsyncTerminable;
1135
- /**
1136
- * Creates a DEFLATE decompression that can be used in ZIP archives
1137
- */
1138
- constructor(_: string, sz?: number);
1139
- push(data: Uint8Array, final: boolean): void;
1140
- }
1141
- /**
1142
- * A ZIP archive decompression stream that emits files as they are discovered
1143
- */
1144
- export class Unzip {
1145
- private d;
1146
- private c;
1147
- private p;
1148
- private k;
1149
- private o;
1150
- /**
1151
- * Creates a ZIP decompression stream
1152
- * @param cb The callback to call whenever a file in the ZIP archive is found
1153
- */
1154
- constructor(cb?: UnzipFileHandler);
1155
- /**
1156
- * Pushes a chunk to be unzipped
1157
- * @param chunk The chunk to push
1158
- * @param final Whether this is the last chunk
1159
- */
1160
- push(chunk: Uint8Array, final?: boolean): any;
1161
- /**
1162
- * Registers a decoder with the stream, allowing for files compressed with
1163
- * the compression type provided to be expanded correctly
1164
- * @param decoder The decoder constructor
1165
- */
1166
- register(decoder: UnzipDecoderConstructor): void;
1167
- /**
1168
- * The handler to call whenever a file is discovered
1169
- */
1170
- onfile: UnzipFileHandler;
1171
- }
1172
- /**
1173
- * Asynchronously decompresses a ZIP archive
1174
- * @param data The raw compressed ZIP file
1175
- * @param cb The callback to call with the decompressed files
1176
- * @returns A function that can be used to immediately terminate the unzipping
1177
- */
1178
- export function unzip(data: Uint8Array, cb: UnzipCallback): AsyncTerminable;
1179
- /**
1180
- * Synchronously decompresses a ZIP archive. Prefer using `unzip` for better
1181
- * performance with more than one file.
1182
- * @param data The raw compressed ZIP file
1183
- * @returns The decompressed files
1184
- */
1185
- export function unzipSync(data: Uint8Array): Unzipped;