@zip.js/zip.js 2.8.53 → 2.8.54
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.
- package/README.md +1 -1
- package/deno.json +2 -1
- package/dist/zip-core-external.js +691 -482
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +698 -481
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +729 -511
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +691 -496
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +729 -511
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +743 -512
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +742 -511
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +700 -483
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +700 -483
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +699 -482
- package/dist/zip.min.js +1 -1
- package/eslint.config.mjs +1 -0
- package/index-native.cjs +743 -512
- package/index-native.min.js +1 -1
- package/index.cjs +742 -511
- package/index.d.cts +398 -42
- package/index.d.ts +398 -42
- package/index.min.js +1 -1
- package/lib/core/configuration.js +62 -21
- package/lib/core/constants.js +11 -1
- package/lib/core/io.js +33 -27
- package/lib/core/options.js +44 -2
- package/lib/core/streams/aes-crypto-stream.js +12 -12
- package/lib/core/util/decode-text.js +11 -2
- package/lib/core/web-worker-base.js +3 -2
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-fs.js +38 -27
- package/lib/core/zip-reader.js +58 -26
- package/lib/core/zip-writer.js +293 -177
- package/lib/zip-core-base.js +6 -1
- package/lib/zip-core-reader.js +1 -0
- package/lib/zip-core-writer.js +4 -0
- package/package.json +8 -2
package/index.d.ts
CHANGED
|
@@ -190,6 +190,32 @@ declare class TransformStreamLike {
|
|
|
190
190
|
writable: WritableStream;
|
|
191
191
|
}
|
|
192
192
|
|
|
193
|
+
/**
|
|
194
|
+
* Represents a generic class compressing data, e.g. the native `CompressionStream` class.
|
|
195
|
+
*/
|
|
196
|
+
declare class CompressionStreamLike extends TransformStreamLike {
|
|
197
|
+
/**
|
|
198
|
+
* Creates the stream
|
|
199
|
+
*
|
|
200
|
+
* @param format The compression format.
|
|
201
|
+
* @param options The options.
|
|
202
|
+
*/
|
|
203
|
+
constructor(format: string, options?: CompressionStreamOptions);
|
|
204
|
+
}
|
|
205
|
+
|
|
206
|
+
/**
|
|
207
|
+
* Represents a generic class decompressing data, e.g. the native `DecompressionStream` class.
|
|
208
|
+
*/
|
|
209
|
+
declare class DecompressionStreamLike extends TransformStreamLike {
|
|
210
|
+
/**
|
|
211
|
+
* Creates the stream
|
|
212
|
+
*
|
|
213
|
+
* @param format The decompression format.
|
|
214
|
+
* @param options The options.
|
|
215
|
+
*/
|
|
216
|
+
constructor(format: string, options?: DecompressionStreamOptions);
|
|
217
|
+
}
|
|
218
|
+
|
|
193
219
|
/**
|
|
194
220
|
* Configures zip.js
|
|
195
221
|
*
|
|
@@ -237,27 +263,20 @@ export interface CodecDefinition {
|
|
|
237
263
|
format: string;
|
|
238
264
|
/**
|
|
239
265
|
* The URL of a module exporting the `CompressionStream` and/or `DecompressionStream` classes of
|
|
240
|
-
* the codec. Relative URLs are resolved against
|
|
241
|
-
* (e.g. via `import.meta.resolve()`) is recommended.
|
|
266
|
+
* the codec. Relative URLs are resolved against {@link Configuration#baseURI}; passing an absolute
|
|
267
|
+
* URL (e.g. via `import.meta.resolve()`) is recommended.
|
|
242
268
|
*/
|
|
243
269
|
codecURI?: string;
|
|
244
270
|
/**
|
|
245
|
-
* The stream implementation used to compress data, constructed with
|
|
246
|
-
*
|
|
271
|
+
* The stream implementation used to compress data, constructed with `(format, options)`, see
|
|
272
|
+
* {@link CompressionStreamOptions}.
|
|
247
273
|
*/
|
|
248
|
-
CompressionStream?: typeof
|
|
274
|
+
CompressionStream?: typeof CompressionStreamLike;
|
|
249
275
|
/**
|
|
250
|
-
* The stream implementation used to decompress data, constructed with
|
|
251
|
-
*
|
|
252
|
-
*
|
|
253
|
-
* `compressionMethod` allows codecs registered for multiple methods with the same format to
|
|
254
|
-
* distinguish them (e.g. Reduce, methods 2 to 5). `rawBitFlag` exposes the general purpose bit
|
|
255
|
-
* flag of the entry, which some methods need to decode the data (e.g. the dictionary size and
|
|
256
|
-
* number of trees of Implode, or the end-of-stream marker presence of LZMA). `uncompressedSize`
|
|
257
|
-
* allows size-driven decoders (e.g. Shrink, Reduce, Implode, LZMA without end-of-stream marker)
|
|
258
|
-
* to stop at the exact output size instead of decoding trailing padding bits.
|
|
276
|
+
* The stream implementation used to decompress data, constructed with `(format, options)`, see
|
|
277
|
+
* {@link DecompressionStreamOptions}.
|
|
259
278
|
*/
|
|
260
|
-
DecompressionStream?: typeof
|
|
279
|
+
DecompressionStream?: typeof DecompressionStreamLike;
|
|
261
280
|
/**
|
|
262
281
|
* The minimum "version needed to extract" value written in zip entry headers (e.g. `63` for
|
|
263
282
|
* Zstandard).
|
|
@@ -265,6 +284,72 @@ export interface CodecDefinition {
|
|
|
265
284
|
versionNeeded?: number;
|
|
266
285
|
}
|
|
267
286
|
|
|
287
|
+
/**
|
|
288
|
+
* Represents the options passed as the second argument to the constructor of the classes
|
|
289
|
+
* compressing data, i.e. {@link CodecDefinition#CompressionStream},
|
|
290
|
+
* {@link Configuration#CompressionStream} and {@link Configuration#CompressionStreamFallback}.
|
|
291
|
+
*/
|
|
292
|
+
export interface CompressionStreamOptions {
|
|
293
|
+
/**
|
|
294
|
+
* The compression level, see {@link ZipWriterConstructorOptions#level}.
|
|
295
|
+
*/
|
|
296
|
+
level?: number;
|
|
297
|
+
/**
|
|
298
|
+
* The size of the chunks in bytes, see {@link Configuration#chunkSize}.
|
|
299
|
+
*/
|
|
300
|
+
chunkSize?: number;
|
|
301
|
+
/**
|
|
302
|
+
* The compression method of the entry. It allows codecs registered for several methods sharing
|
|
303
|
+
* the same format to distinguish them (e.g. Reduce, methods 2 to 5).
|
|
304
|
+
*
|
|
305
|
+
* It is only set for the codecs registered with {@link registerCodec}.
|
|
306
|
+
*/
|
|
307
|
+
compressionMethod?: number;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* Represents the options passed as the second argument to the constructor of the classes
|
|
312
|
+
* decompressing data, i.e. {@link CodecDefinition#DecompressionStream},
|
|
313
|
+
* {@link Configuration#DecompressionStream} and {@link Configuration#DecompressionStreamFallback}.
|
|
314
|
+
*/
|
|
315
|
+
export interface DecompressionStreamOptions {
|
|
316
|
+
/**
|
|
317
|
+
* The size of the chunks in bytes, see {@link Configuration#chunkSize}.
|
|
318
|
+
*/
|
|
319
|
+
chunkSize?: number;
|
|
320
|
+
/**
|
|
321
|
+
* `true` when the data is compressed with the Deflate64 method, the format passed as the first
|
|
322
|
+
* argument being `"deflate64-raw"` instead of `"deflate-raw"`.
|
|
323
|
+
*
|
|
324
|
+
* It is only set for the classes decompressing the deflate methods, i.e.
|
|
325
|
+
* {@link Configuration#DecompressionStream} and {@link Configuration#DecompressionStreamFallback}.
|
|
326
|
+
*/
|
|
327
|
+
deflate64?: boolean;
|
|
328
|
+
/**
|
|
329
|
+
* The compression method of the entry. It allows codecs registered for several methods sharing
|
|
330
|
+
* the same format to distinguish them (e.g. Reduce, methods 2 to 5).
|
|
331
|
+
*
|
|
332
|
+
* It is only set for the codecs registered with {@link registerCodec}.
|
|
333
|
+
*/
|
|
334
|
+
compressionMethod?: number;
|
|
335
|
+
/**
|
|
336
|
+
* The general purpose bit flag of the entry, which some methods need to decode the data (e.g. the
|
|
337
|
+
* dictionary size and the number of trees of Implode, or the presence of the end-of-stream marker
|
|
338
|
+
* of LZMA).
|
|
339
|
+
*
|
|
340
|
+
* It is only set for the codecs registered with {@link registerCodec}.
|
|
341
|
+
*/
|
|
342
|
+
rawBitFlag?: number;
|
|
343
|
+
/**
|
|
344
|
+
* The uncompressed size of the entry declared in its header, undefined when the size is unknown.
|
|
345
|
+
* It allows size-driven decoders (e.g. Shrink, Reduce, Implode, LZMA without end-of-stream
|
|
346
|
+
* marker) to stop at the exact output size instead of decoding trailing padding bits.
|
|
347
|
+
*
|
|
348
|
+
* It is only set for the codecs registered with {@link registerCodec}.
|
|
349
|
+
*/
|
|
350
|
+
uncompressedSize?: number;
|
|
351
|
+
}
|
|
352
|
+
|
|
268
353
|
/**
|
|
269
354
|
* Represents the configuration passed to {@link configure}.
|
|
270
355
|
*/
|
|
@@ -272,6 +357,8 @@ export interface Configuration extends WorkerConfiguration {
|
|
|
272
357
|
/**
|
|
273
358
|
* The maximum number of web workers used to compress/decompress data simultaneously.
|
|
274
359
|
*
|
|
360
|
+
* It must be an integer greater than 0, see {@link ERR_INVALID_MAX_WORKERS}.
|
|
361
|
+
*
|
|
275
362
|
* @defaultValue `navigator.hardwareConcurrency`, or 2 when the environment does not provide it
|
|
276
363
|
*/
|
|
277
364
|
maxWorkers?: number;
|
|
@@ -297,6 +384,13 @@ export interface Configuration extends WorkerConfiguration {
|
|
|
297
384
|
* @defaultValue 5000
|
|
298
385
|
*/
|
|
299
386
|
workerStartupTimeout?: number;
|
|
387
|
+
/**
|
|
388
|
+
* The base URL against which the relative URIs are resolved, i.e. {@link Configuration#workerURI},
|
|
389
|
+
* {@link Configuration#wasmURI} and {@link CodecDefinition#codecURI}.
|
|
390
|
+
*
|
|
391
|
+
* @defaultValue the URL of the module of zip.js
|
|
392
|
+
*/
|
|
393
|
+
baseURI?: string;
|
|
300
394
|
/**
|
|
301
395
|
* The URI of the web worker.
|
|
302
396
|
*
|
|
@@ -311,6 +405,9 @@ export interface Configuration extends WorkerConfiguration {
|
|
|
311
405
|
* });
|
|
312
406
|
* ```
|
|
313
407
|
*
|
|
408
|
+
* The worker is created as a module worker, unless the URI is a Data URI or a Blob URI, in which case it is created as a classic
|
|
409
|
+
* worker. See {@link Configuration#createWorker} for an example of classic worker script installing a polyfill of the Streams API.
|
|
410
|
+
*
|
|
314
411
|
* @defaultValue "./core/web-worker-wasm.js", or "./core/web-worker-native.js" for the builds using the native implementations
|
|
315
412
|
*/
|
|
316
413
|
workerURI?: string;
|
|
@@ -325,6 +422,21 @@ export interface Configuration extends WorkerConfiguration {
|
|
|
325
422
|
* createWorker: () => new Worker(new URL("./zip-worker.js", import.meta.url), { type: "module" })
|
|
326
423
|
* });
|
|
327
424
|
* ```
|
|
425
|
+
*
|
|
426
|
+
* It is also the way to run the web workers on engines where `TransformStream` is missing from the scope of the workers, e.g. Firefox
|
|
427
|
+
* before version 102. There, the worker script of zip.js throws when it is evaluated and the data is silently compressed/decompressed
|
|
428
|
+
* in the main scope instead. A polyfill imported by the page does not help, because the worker reads the globals of the Streams API
|
|
429
|
+
* from its own scope, so it has to be installed by the worker itself before the worker script of zip.js runs. These engines predate
|
|
430
|
+
* the support of module workers, hence the classic worker script below:
|
|
431
|
+
* ```
|
|
432
|
+
* // zip-worker-with-polyfill.js
|
|
433
|
+
* importScripts("./web-streams-polyfill.js", "./zip-web-worker.js");
|
|
434
|
+
* ```
|
|
435
|
+
* ```
|
|
436
|
+
* configure({
|
|
437
|
+
* createWorker: () => new Worker("./zip-worker-with-polyfill.js")
|
|
438
|
+
* });
|
|
439
|
+
* ```
|
|
328
440
|
*/
|
|
329
441
|
createWorker?: () => Worker;
|
|
330
442
|
/**
|
|
@@ -345,6 +457,9 @@ export interface Configuration extends WorkerConfiguration {
|
|
|
345
457
|
/**
|
|
346
458
|
* The size of the chunks in bytes during data compression/decompression.
|
|
347
459
|
*
|
|
460
|
+
* Values lower than 64 are raised to 64, and a value that is not an integer greater than 0 is replaced with the default
|
|
461
|
+
* value.
|
|
462
|
+
*
|
|
348
463
|
* @defaultValue 65536
|
|
349
464
|
*/
|
|
350
465
|
chunkSize?: number;
|
|
@@ -353,33 +468,33 @@ export interface Configuration extends WorkerConfiguration {
|
|
|
353
468
|
*
|
|
354
469
|
* @defaultValue the global `CompressionStream`, or `false` when the environment does not provide it
|
|
355
470
|
*/
|
|
356
|
-
CompressionStream?: typeof
|
|
471
|
+
CompressionStream?: typeof CompressionStreamLike;
|
|
357
472
|
/**
|
|
358
473
|
* The stream implementation used to decompress data when `useCompressionStream` is set to `true`.
|
|
359
474
|
*
|
|
360
475
|
* @defaultValue the global `DecompressionStream`, or `false` when the environment does not provide it
|
|
361
476
|
*/
|
|
362
|
-
DecompressionStream?: typeof
|
|
477
|
+
DecompressionStream?: typeof DecompressionStreamLike;
|
|
363
478
|
/**
|
|
364
479
|
* The stream implementation used to compress data when `useCompressionStream` is set to `false`.
|
|
365
480
|
*
|
|
366
481
|
* @defaultValue the implementation embedded in the entry point that was imported, e.g. the WebAssembly one
|
|
367
482
|
*/
|
|
368
|
-
CompressionStreamFallback?: typeof
|
|
483
|
+
CompressionStreamFallback?: typeof CompressionStreamLike;
|
|
369
484
|
/**
|
|
370
485
|
* The stream implementation used to decompress data when `useCompressionStream` is set to `false`.
|
|
371
486
|
*
|
|
372
487
|
* @defaultValue the implementation embedded in the entry point that was imported, e.g. the WebAssembly one
|
|
373
488
|
*/
|
|
374
|
-
DecompressionStreamFallback?: typeof
|
|
489
|
+
DecompressionStreamFallback?: typeof DecompressionStreamLike;
|
|
375
490
|
/**
|
|
376
491
|
* @deprecated Use {@link Configuration#CompressionStreamFallback} instead.
|
|
377
492
|
*/
|
|
378
|
-
CompressionStreamZlib?: typeof
|
|
493
|
+
CompressionStreamZlib?: typeof CompressionStreamLike;
|
|
379
494
|
/**
|
|
380
495
|
* @deprecated Use {@link Configuration#DecompressionStreamFallback} instead.
|
|
381
496
|
*/
|
|
382
|
-
DecompressionStreamZlib?: typeof
|
|
497
|
+
DecompressionStreamZlib?: typeof DecompressionStreamLike;
|
|
383
498
|
}
|
|
384
499
|
|
|
385
500
|
/**
|
|
@@ -471,22 +586,17 @@ export function initWorker(options?: {
|
|
|
471
586
|
/**
|
|
472
587
|
* The stream implementation used to compress data when `useCompressionStream` is set to `false` or when `CompressionStream` is unsupported.
|
|
473
588
|
*/
|
|
474
|
-
CompressionStreamFallback?: typeof
|
|
589
|
+
CompressionStreamFallback?: typeof CompressionStreamLike;
|
|
475
590
|
/**
|
|
476
591
|
* The stream implementation used to decompress data when `useCompressionStream` is set to `false` or when `DecompressionStream` is unsupported.
|
|
477
592
|
*/
|
|
478
|
-
DecompressionStreamFallback?: typeof
|
|
593
|
+
DecompressionStreamFallback?: typeof DecompressionStreamLike;
|
|
479
594
|
/**
|
|
480
595
|
* The function called before resolving the stream implementations, e.g. to load a WebAssembly module.
|
|
481
596
|
*/
|
|
482
597
|
init?(config: Configuration): Promise<unknown> | unknown;
|
|
483
598
|
}): void;
|
|
484
599
|
|
|
485
|
-
/**
|
|
486
|
-
* Represents a class implementing `CompressionStream` or `DecompressionStream` interfaces.
|
|
487
|
-
*/
|
|
488
|
-
declare class CodecStream extends TransformStream {}
|
|
489
|
-
|
|
490
600
|
/**
|
|
491
601
|
* Returns the MIME type corresponding to a filename extension.
|
|
492
602
|
*
|
|
@@ -699,6 +809,8 @@ export interface CreateReadableOptions {
|
|
|
699
809
|
/**
|
|
700
810
|
* The size in bytes of the chunks emitted by the default implementation (the `chunkSize` value
|
|
701
811
|
* of the global configuration by default).
|
|
812
|
+
*
|
|
813
|
+
* It is normalized like {@link Configuration#chunkSize}.
|
|
702
814
|
*/
|
|
703
815
|
chunkSize?: number;
|
|
704
816
|
}
|
|
@@ -743,6 +855,10 @@ type URLString = string;
|
|
|
743
855
|
* Represents a {@link Reader} instance used to fetch data from a URL.
|
|
744
856
|
*/
|
|
745
857
|
export class HttpReader extends Reader<URLString> {
|
|
858
|
+
/**
|
|
859
|
+
* The URL of the data, as passed to the constructor.
|
|
860
|
+
*/
|
|
861
|
+
url: URLString | URL;
|
|
746
862
|
/**
|
|
747
863
|
* Creates the {@link HttpReader} instance
|
|
748
864
|
*
|
|
@@ -859,6 +975,12 @@ export interface WritableWriter {
|
|
|
859
975
|
* The `WritableStream` instance.
|
|
860
976
|
*/
|
|
861
977
|
writable: WritableStream;
|
|
978
|
+
/**
|
|
979
|
+
* The number of bytes written into the instance. It is set to 0 before the first write and
|
|
980
|
+
* updated as the data is written, so a writer needing the value (e.g. to compute the offset of a
|
|
981
|
+
* disk) can read it.
|
|
982
|
+
*/
|
|
983
|
+
size?: number;
|
|
862
984
|
/**
|
|
863
985
|
* The maximum size of split data when creating a {@link ZipWriter} instance or when calling {@link FileEntry#getData} with a generator of {@link WritableWriter} instances.
|
|
864
986
|
*/
|
|
@@ -895,6 +1017,10 @@ export class Writer<Type> implements Initializable, WritableWriter {
|
|
|
895
1017
|
* The `WritableStream` instance.
|
|
896
1018
|
*/
|
|
897
1019
|
writable: WritableStream;
|
|
1020
|
+
/**
|
|
1021
|
+
* The number of bytes written into the instance.
|
|
1022
|
+
*/
|
|
1023
|
+
size: number;
|
|
898
1024
|
/**
|
|
899
1025
|
* Initializes the instance asynchronously
|
|
900
1026
|
*
|
|
@@ -920,13 +1046,35 @@ export class Writer<Type> implements Initializable, WritableWriter {
|
|
|
920
1046
|
/**
|
|
921
1047
|
* Represents a {@link Writer} instance used to retrieve the written data as a `string`.
|
|
922
1048
|
*/
|
|
923
|
-
export class TextWriter
|
|
1049
|
+
export class TextWriter implements Initializable, WritableWriter {
|
|
1050
|
+
/**
|
|
1051
|
+
* The `WritableStream` instance.
|
|
1052
|
+
*/
|
|
1053
|
+
writable: WritableStream;
|
|
1054
|
+
/**
|
|
1055
|
+
* The number of bytes written into the instance.
|
|
1056
|
+
*/
|
|
1057
|
+
size: number;
|
|
1058
|
+
/**
|
|
1059
|
+
* The encoding of the text returned by {@link TextWriter#getData}.
|
|
1060
|
+
*/
|
|
1061
|
+
encoding?: string;
|
|
1062
|
+
/**
|
|
1063
|
+
* Initializes the instance asynchronously
|
|
1064
|
+
*/
|
|
1065
|
+
init(): Promise<void>;
|
|
924
1066
|
/**
|
|
925
1067
|
* Creates the {@link TextWriter} instance
|
|
926
1068
|
*
|
|
927
1069
|
* @param encoding The encoding of the text.
|
|
928
1070
|
*/
|
|
929
1071
|
constructor(encoding?: string);
|
|
1072
|
+
/**
|
|
1073
|
+
* Retrieves all the written data
|
|
1074
|
+
*
|
|
1075
|
+
* @returns A promise resolving to the written data.
|
|
1076
|
+
*/
|
|
1077
|
+
getData(): Promise<string>;
|
|
930
1078
|
}
|
|
931
1079
|
|
|
932
1080
|
/**
|
|
@@ -937,6 +1085,15 @@ export class BlobWriter implements Initializable, WritableWriter {
|
|
|
937
1085
|
* The `WritableStream` instance.
|
|
938
1086
|
*/
|
|
939
1087
|
writable: WritableStream;
|
|
1088
|
+
/**
|
|
1089
|
+
* The number of bytes written into the instance.
|
|
1090
|
+
*/
|
|
1091
|
+
size: number;
|
|
1092
|
+
/**
|
|
1093
|
+
* The MIME type of the content, i.e. the type of the `Blob` instance returned by
|
|
1094
|
+
* {@link BlobWriter#getData}.
|
|
1095
|
+
*/
|
|
1096
|
+
contentType?: string;
|
|
940
1097
|
/**
|
|
941
1098
|
* Initializes the instance asynchronously
|
|
942
1099
|
*/
|
|
@@ -959,6 +1116,11 @@ export class BlobWriter implements Initializable, WritableWriter {
|
|
|
959
1116
|
* Represents a {@link Writer} instance used to retrieve the written data as a Data URI `string` encoded in Base64.
|
|
960
1117
|
*/
|
|
961
1118
|
export class Data64URIWriter extends Writer<string> {
|
|
1119
|
+
/**
|
|
1120
|
+
* The MIME type of the content, i.e. the type declared by the Data URI returned by
|
|
1121
|
+
* {@link Data64URIWriter#getData}.
|
|
1122
|
+
*/
|
|
1123
|
+
contentType?: string;
|
|
962
1124
|
/**
|
|
963
1125
|
* Creates the {@link Data64URIWriter} instance
|
|
964
1126
|
*
|
|
@@ -975,6 +1137,10 @@ export class SplitDataWriter implements Initializable, WritableWriter {
|
|
|
975
1137
|
* The `WritableStream` instance.
|
|
976
1138
|
*/
|
|
977
1139
|
writable: WritableStream;
|
|
1140
|
+
/**
|
|
1141
|
+
* The number of bytes written into the instance.
|
|
1142
|
+
*/
|
|
1143
|
+
size: number;
|
|
978
1144
|
/**
|
|
979
1145
|
* The number of the disk being written.
|
|
980
1146
|
*/
|
|
@@ -1119,6 +1285,13 @@ export class ZipReader<Type> {
|
|
|
1119
1285
|
);
|
|
1120
1286
|
/**
|
|
1121
1287
|
* The global comment of the zip file.
|
|
1288
|
+
*
|
|
1289
|
+
* @remarks
|
|
1290
|
+
* Unlike {@link EntryMetaData#comment}, it is exposed as raw bytes because the zip format defines no
|
|
1291
|
+
* way to record its encoding: section 4.4.26 of the zip specification says nothing about it, and the
|
|
1292
|
+
* end of central directory record has neither a general purpose bit flag nor an extra field, so the
|
|
1293
|
+
* language encoding flag (see Appendix D - Language Encoding (EFS)) cannot apply to it. Decode it with
|
|
1294
|
+
* the encoding agreed with the producer of the zip file.
|
|
1122
1295
|
*/
|
|
1123
1296
|
comment: Uint8Array;
|
|
1124
1297
|
/**
|
|
@@ -1864,13 +2037,24 @@ export interface LocalDirectory {
|
|
|
1864
2037
|
extraFieldUSDZ?: EntryExtraField;
|
|
1865
2038
|
}
|
|
1866
2039
|
/**
|
|
1867
|
-
* Represents an error raised while processing an
|
|
2040
|
+
* Represents an error raised while processing an archive or one of its entries, decorated with context.
|
|
1868
2041
|
*/
|
|
1869
2042
|
export interface EntryError extends Error {
|
|
1870
2043
|
/**
|
|
1871
2044
|
* `true` if the zip file is corrupted because the entry data could not be written entirely.
|
|
1872
2045
|
*/
|
|
1873
2046
|
corruptedEntry?: boolean;
|
|
2047
|
+
/**
|
|
2048
|
+
* The entry whose data overlaps the data of the entry being read, set on the
|
|
2049
|
+
* {@link ERR_OVERLAPPING_ENTRY} error raised by {@link ZipReaderOptions#checkOverlappingEntry}.
|
|
2050
|
+
* It is the only way to identify the other entry of the pair.
|
|
2051
|
+
*/
|
|
2052
|
+
overlappingEntry?: Entry;
|
|
2053
|
+
/**
|
|
2054
|
+
* The ambiguity that was detected, set on the {@link ERR_AMBIGUOUS_ARCHIVE} error raised by
|
|
2055
|
+
* {@link GetEntriesOptions#strictness}. See {@link ERR_AMBIGUOUS_ARCHIVE} for the values it takes.
|
|
2056
|
+
*/
|
|
2057
|
+
reason?: string;
|
|
1874
2058
|
/**
|
|
1875
2059
|
* The id of the related {@link ZipEntry} (filesystem API).
|
|
1876
2060
|
*/
|
|
@@ -2418,6 +2602,10 @@ export class ZipWriter<Type> {
|
|
|
2418
2602
|
* Adds an existing zip file at the beginning of the current zip. This method
|
|
2419
2603
|
* cannot be called after the first call to {@link ZipWriter#add}.
|
|
2420
2604
|
*
|
|
2605
|
+
* @remarks The data of the zip file is copied, its central directory is rebuilt and its entries are relocated to
|
|
2606
|
+
* the positions they get in the output. The disks of a split zip file passed as input are therefore unrelated to
|
|
2607
|
+
* the disks of the output, which is a single zip file unless the writer is a split zip file writer.
|
|
2608
|
+
*
|
|
2421
2609
|
* @param reader The {@link Reader} instance used to read the content of the zip file.
|
|
2422
2610
|
* @returns A promise resolving when the zip file has been added.
|
|
2423
2611
|
*/
|
|
@@ -2466,6 +2654,10 @@ export class ZipWriter<Type> {
|
|
|
2466
2654
|
/**
|
|
2467
2655
|
* Writes the entries directory, writes the global comment, and returns the content of the zip file
|
|
2468
2656
|
*
|
|
2657
|
+
* @remarks
|
|
2658
|
+
* The global comment is passed as raw bytes and the comment of an entry
|
|
2659
|
+
* ({@link ZipWriterAddDataOptions#comment}) as a string on purpose, see {@link ZipReader#comment}.
|
|
2660
|
+
*
|
|
2469
2661
|
* @param comment The global comment of the zip file.
|
|
2470
2662
|
* @param options The options.
|
|
2471
2663
|
* @returns The content of the zip file.
|
|
@@ -2494,6 +2686,13 @@ export interface ZipWriterAddDataOptions
|
|
|
2494
2686
|
executable?: boolean;
|
|
2495
2687
|
/**
|
|
2496
2688
|
* The comment of the entry.
|
|
2689
|
+
*
|
|
2690
|
+
* @remarks
|
|
2691
|
+
* It is a string, unlike the global comment passed to {@link ZipWriter#close}, because the encoding of
|
|
2692
|
+
* the comment of an entry is recorded in the header by the general purpose bit 11 (see Appendix D -
|
|
2693
|
+
* Language Encoding (EFS)), set by {@link ZipWriterConstructorOptions#useUnicodeFileNames}. Passing raw
|
|
2694
|
+
* bytes here throws {@link ERR_INVALID_ENTRY_COMMENT_TYPE} instead of writing their textual
|
|
2695
|
+
* representation.
|
|
2497
2696
|
*/
|
|
2498
2697
|
comment?: string;
|
|
2499
2698
|
/**
|
|
@@ -2651,6 +2850,11 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
2651
2850
|
/**
|
|
2652
2851
|
* The last modification date.
|
|
2653
2852
|
*
|
|
2853
|
+
* @remarks
|
|
2854
|
+
* This option and the two below must be `Date` instances: a timestamp expressed in milliseconds, e.g.
|
|
2855
|
+
* {@link File#lastModified}, and an invalid `Date` are both rejected with {@link ERR_INVALID_DATE}. An
|
|
2856
|
+
* invalid `Date` used to be written as an entry carrying no timestamp at all.
|
|
2857
|
+
*
|
|
2654
2858
|
* @defaultValue The current date.
|
|
2655
2859
|
*/
|
|
2656
2860
|
lastModDate?: Date;
|
|
@@ -2747,7 +2951,9 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
2747
2951
|
*
|
|
2748
2952
|
* It also selects the MS-DOS platform for {@link ZipWriterConstructorOptions#versionMadeBy} and leaves the Unix
|
|
2749
2953
|
* attributes out of the entries. Setting any Unix metadata option, e.g.
|
|
2750
|
-
* {@link ZipWriterConstructorOptions#unixMode}, turns it back off
|
|
2954
|
+
* {@link ZipWriterConstructorOptions#unixMode} or {@link ZipWriterAddDataOptions#executable}, turns it back off, and setting
|
|
2955
|
+
* {@link ZipWriterConstructorOptions#msdosAttributesRaw} or {@link ZipWriterConstructorOptions#msdosAttributes}
|
|
2956
|
+
* turns it on, overriding an explicit `false`.
|
|
2751
2957
|
*
|
|
2752
2958
|
* @defaultValue false
|
|
2753
2959
|
*/
|
|
@@ -2824,10 +3030,28 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
2824
3030
|
/**
|
|
2825
3031
|
* When provided, the low 8-bit MS-DOS attributes to write into external file attributes.
|
|
2826
3032
|
* Must be an integer between 0 and 255.
|
|
3033
|
+
*
|
|
3034
|
+
* @remarks
|
|
3035
|
+
* Setting this option or {@link ZipWriterConstructorOptions#msdosAttributes} selects the MS-DOS platform for
|
|
3036
|
+
* the entry exactly as {@link ZipWriterConstructorOptions#msDosCompatible} does, and overrides that option
|
|
3037
|
+
* when it is explicitly set to `false`. {@link EntryMetaData#versionMadeBy} then loses its Unix upper byte
|
|
3038
|
+
* and no Unix mode is written, so the `0o100644` of a file entry and the `0o040755` of a folder entry are
|
|
3039
|
+
* lost. What counts is that the option is provided, not its value: `0` and `{}` trigger it too.
|
|
3040
|
+
*
|
|
3041
|
+
* Setting any Unix metadata option, i.e. {@link ZipWriterConstructorOptions#uid},
|
|
3042
|
+
* {@link ZipWriterConstructorOptions#gid}, {@link ZipWriterConstructorOptions#unixMode},
|
|
3043
|
+
* {@link ZipWriterConstructorOptions#unixExtraFieldType} or {@link ZipWriterAddDataOptions#executable},
|
|
3044
|
+
* takes precedence and keeps the Unix attributes, with the MS-DOS attributes written into the low byte.
|
|
3045
|
+
* {@link ZipWriterConstructorOptions#externalFileAttributes} is preserved as well, although the entry still
|
|
3046
|
+
* declares the MS-DOS platform.
|
|
2827
3047
|
*/
|
|
2828
3048
|
msdosAttributesRaw?: number;
|
|
2829
3049
|
/**
|
|
2830
3050
|
* When provided, MS-DOS attribute flags (boolean object) to write into external file attributes low byte.
|
|
3051
|
+
*
|
|
3052
|
+
* @remarks
|
|
3053
|
+
* See {@link ZipWriterConstructorOptions#msdosAttributesRaw} for the platform this option selects and for
|
|
3054
|
+
* the Unix metadata it leaves out of the entry.
|
|
2831
3055
|
*/
|
|
2832
3056
|
msdosAttributes?: {
|
|
2833
3057
|
readOnly?: boolean;
|
|
@@ -2944,7 +3168,7 @@ export interface EntryOnprogressOptions {
|
|
|
2944
3168
|
/**
|
|
2945
3169
|
* Represents an entry in a zip file (Filesystem API).
|
|
2946
3170
|
*/
|
|
2947
|
-
|
|
3171
|
+
export class ZipEntry {
|
|
2948
3172
|
/**
|
|
2949
3173
|
* The relative filename of the entry.
|
|
2950
3174
|
*/
|
|
@@ -2973,6 +3197,15 @@ declare class ZipEntry {
|
|
|
2973
3197
|
* The children of the entry.
|
|
2974
3198
|
*/
|
|
2975
3199
|
children: ZipEntry[];
|
|
3200
|
+
/**
|
|
3201
|
+
* The options applied to the entry when the zip file is exported.
|
|
3202
|
+
*
|
|
3203
|
+
* @remarks
|
|
3204
|
+
* These are the options passed when the entry was added to the filesystem, updated by
|
|
3205
|
+
* {@link ZipEntry#setOptions}. An entry imported from a zip file has none until
|
|
3206
|
+
* {@link ZipEntry#setOptions} is called.
|
|
3207
|
+
*/
|
|
3208
|
+
readonly options?: ZipWriterAddDataOptions;
|
|
2976
3209
|
/**
|
|
2977
3210
|
* Clones the entry
|
|
2978
3211
|
*
|
|
@@ -3010,6 +3243,24 @@ declare class ZipEntry {
|
|
|
3010
3243
|
* @param name The new name of the entry.
|
|
3011
3244
|
*/
|
|
3012
3245
|
rename(name: string): void;
|
|
3246
|
+
/**
|
|
3247
|
+
* Sets the options applied to the entry when the zip file is exported
|
|
3248
|
+
*
|
|
3249
|
+
* @remarks
|
|
3250
|
+
* The options are merged into {@link ZipEntry#options}, and an option set to `undefined` is removed
|
|
3251
|
+
* from it instead of being stored. They take precedence over the options passed to
|
|
3252
|
+
* `{@link ZipDirectoryEntry}#export*()` and over the metadata of the entry they were imported from,
|
|
3253
|
+
* exactly like the options passed when adding an entry to the filesystem.
|
|
3254
|
+
*
|
|
3255
|
+
* The options describing the data of an entry exported as-is, e.g.
|
|
3256
|
+
* {@link ZipWriterConstructorOptions#compressionMethod} and
|
|
3257
|
+
* {@link ZipWriterAddDataOptions#uncompressedSize}, are ignored: they are always the ones of the
|
|
3258
|
+
* original entry. The {@link ZipWriterAddDataOptions#directory} option and the progress callbacks
|
|
3259
|
+
* are ignored as well. Invalid option values are reported when the zip file is exported.
|
|
3260
|
+
*
|
|
3261
|
+
* @param options The options.
|
|
3262
|
+
*/
|
|
3263
|
+
setOptions(options: ZipWriterAddDataOptions): void;
|
|
3013
3264
|
}
|
|
3014
3265
|
|
|
3015
3266
|
/**
|
|
@@ -3163,7 +3414,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3163
3414
|
* before the children of its subdirectories, like the result of `readdir(path, { recursive: true })` in
|
|
3164
3415
|
* Node.js. This is also the order in which `{@link ZipDirectoryEntry}#export*()` writes them.
|
|
3165
3416
|
*
|
|
3166
|
-
* Unlike {@link
|
|
3417
|
+
* Unlike {@link ZipFS#entries}, the directory itself is not included and removed entries leave no empty slot.
|
|
3167
3418
|
*
|
|
3168
3419
|
* @param options The options.
|
|
3169
3420
|
* @returns The array of {@link ZipEntry} instances.
|
|
@@ -3377,6 +3628,11 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3377
3628
|
* the same `"a/b.txt"` entry. Filenames are normalized and validated beforehand, see
|
|
3378
3629
|
* {@link GetEntriesOptions#normalizeFilename} and {@link GetEntriesOptions#filenameValidation}.
|
|
3379
3630
|
*
|
|
3631
|
+
* The directories created that way are navigable like any other entry but are not written back when the
|
|
3632
|
+
* tree is exported: only the directories carried by the source zip file and the ones created with
|
|
3633
|
+
* {@link ZipDirectoryEntry#addDirectory} are written. A zip file storing no directory entry therefore
|
|
3634
|
+
* round-trips to a zip file storing no directory entry, instead of gaining one entry per path component.
|
|
3635
|
+
*
|
|
3380
3636
|
* Passing a {@link ZipReader} instance is the way to read the data of the zip file itself, e.g. its
|
|
3381
3637
|
* {@link ZipReader#prependedData} or its {@link ZipReader#comment} property, since the instance created
|
|
3382
3638
|
* otherwise is not exposed. Its options are used as defaults for the options passed here, and it must not
|
|
@@ -3513,7 +3769,7 @@ export interface ZipDirectoryEntryImportHttpOptions
|
|
|
3513
3769
|
HttpOptions {}
|
|
3514
3770
|
|
|
3515
3771
|
/**
|
|
3516
|
-
* Represents the options passed to {@link ZipDirectoryEntry#getChildren} and {@link
|
|
3772
|
+
* Represents the options passed to {@link ZipDirectoryEntry#getChildren} and {@link ZipFS#getChildren}.
|
|
3517
3773
|
*/
|
|
3518
3774
|
export interface ZipDirectoryEntryGetChildrenOptions {
|
|
3519
3775
|
/**
|
|
@@ -3557,6 +3813,13 @@ export interface ZipDirectoryEntryGetChildrenOptions {
|
|
|
3557
3813
|
* {@link ZipDirectoryEntry#exportZip} or {@link ZipDirectoryEntry#exportWritable}. It is ignored by the
|
|
3558
3814
|
* other `{@link ZipDirectoryEntry}#export*()` methods, whose Writer instance can only return its data
|
|
3559
3815
|
* once its writable is closed.
|
|
3816
|
+
*
|
|
3817
|
+
* An entry added without a {@link ZipWriterAddDataOptions#lastModDate} option is dated with the moment
|
|
3818
|
+
* it was added, so exporting an unchanged tree twice produces the same bytes. That date is the weakest
|
|
3819
|
+
* one: it is replaced by the date of the entry the tree was imported from, which is itself replaced by
|
|
3820
|
+
* the {@link ZipWriterConstructorOptions#lastModDate} option passed here, which pins every date of the
|
|
3821
|
+
* exported zip file. Only a {@link ZipWriterAddDataOptions#lastModDate} option passed when the entry
|
|
3822
|
+
* was added takes precedence over all of them.
|
|
3560
3823
|
*/
|
|
3561
3824
|
export interface ZipDirectoryEntryExportOptions
|
|
3562
3825
|
extends ZipWriterConstructorOptions,
|
|
@@ -3620,12 +3883,14 @@ export interface ZipDirectoryEntryExportOptions
|
|
|
3620
3883
|
* The {@link ZipReaderOptions#passThrough} option set here exports the entries imported from a zip
|
|
3621
3884
|
* file as-is, without decompressing and decrypting them, exactly as importing them with this option
|
|
3622
3885
|
* does. It is ignored by the entries added to the filesystem, which are compressed as usual.
|
|
3886
|
+
*
|
|
3887
|
+
* A value which is neither an object nor unset throws an {@link ERR_INVALID_READER_OPTIONS} error.
|
|
3623
3888
|
*/
|
|
3624
3889
|
readerOptions?: ZipReaderConstructorOptions;
|
|
3625
3890
|
}
|
|
3626
3891
|
|
|
3627
3892
|
/**
|
|
3628
|
-
* Represents the options passed to {@link ZipDirectoryEntry#exportFileSystemHandle} and {@link
|
|
3893
|
+
* Represents the options passed to {@link ZipDirectoryEntry#exportFileSystemHandle} and {@link ZipFS#exportFileSystemHandle}.
|
|
3629
3894
|
*
|
|
3630
3895
|
* @remarks
|
|
3631
3896
|
* The {@link ZipReaderOptions#preventClose} option is ignored: the export owns the writable of each
|
|
@@ -3651,6 +3916,8 @@ export interface ZipDirectoryEntryExportFileSystemHandleOptions
|
|
|
3651
3916
|
* These options override the ones passed at the top level. The {@link ZipReaderOptions#password}
|
|
3652
3917
|
* option can be set here or at the top level, unlike {@link ZipDirectoryEntryExportOptions} where
|
|
3653
3918
|
* the top-level password encrypts the exported zip file instead.
|
|
3919
|
+
*
|
|
3920
|
+
* A value which is neither an object nor unset throws an {@link ERR_INVALID_READER_OPTIONS} error.
|
|
3654
3921
|
*/
|
|
3655
3922
|
readerOptions?: ZipReaderConstructorOptions;
|
|
3656
3923
|
}
|
|
@@ -3664,16 +3931,16 @@ export interface ZipDirectoryEntryExportFileSystemHandleOptions
|
|
|
3664
3931
|
* const TEXT_CONTENT = "Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam nonummy nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.";
|
|
3665
3932
|
* const FILENAME = "lorem.txt";
|
|
3666
3933
|
* const BLOB = new Blob([TEXT_CONTENT], { type: zip.getMimeType(FILENAME) });
|
|
3667
|
-
* let zipFs = new zip.
|
|
3934
|
+
* let zipFs = new zip.ZipFS();
|
|
3668
3935
|
* zipFs.addBlob("lorem.txt", BLOB);
|
|
3669
3936
|
* const zippedBlob = await zipFs.exportBlob();
|
|
3670
|
-
* zipFs = new zip.
|
|
3937
|
+
* zipFs = new zip.ZipFS();
|
|
3671
3938
|
* await zipFs.importBlob(zippedBlob);
|
|
3672
3939
|
* const firstEntry = zipFs.children[0];
|
|
3673
3940
|
* const unzippedBlob = await firstEntry.getBlob(zip.getMimeType(firstEntry.name));
|
|
3674
3941
|
* ```
|
|
3675
3942
|
*/
|
|
3676
|
-
export interface
|
|
3943
|
+
export interface ZipFS
|
|
3677
3944
|
extends Pick<
|
|
3678
3945
|
ZipDirectoryEntry,
|
|
3679
3946
|
| "getChildByName"
|
|
@@ -3705,7 +3972,7 @@ export interface FS
|
|
|
3705
3972
|
| "checkPassword"
|
|
3706
3973
|
> {}
|
|
3707
3974
|
|
|
3708
|
-
export class
|
|
3975
|
+
export class ZipFS {
|
|
3709
3976
|
/**
|
|
3710
3977
|
* The root directory.
|
|
3711
3978
|
*/
|
|
@@ -3747,20 +4014,35 @@ export class FS {
|
|
|
3747
4014
|
getById(id: number): ZipEntry | undefined;
|
|
3748
4015
|
}
|
|
3749
4016
|
|
|
4017
|
+
/**
|
|
4018
|
+
* The type of the filesystem.
|
|
4019
|
+
*
|
|
4020
|
+
* @deprecated Use {@link ZipFS} instead.
|
|
4021
|
+
*/
|
|
4022
|
+
export type FS = ZipFS;
|
|
4023
|
+
|
|
3750
4024
|
/**
|
|
3751
4025
|
* The Filesystem API.
|
|
4026
|
+
*
|
|
4027
|
+
* @deprecated Use the {@link ZipFS}, {@link ZipDirectoryEntry} and {@link ZipFileEntry} exports instead.
|
|
3752
4028
|
*/
|
|
3753
4029
|
export const fs: {
|
|
3754
4030
|
/**
|
|
3755
4031
|
* The Filesystem constructor.
|
|
4032
|
+
*
|
|
4033
|
+
* @deprecated Use {@link ZipFS} instead.
|
|
3756
4034
|
*/
|
|
3757
|
-
FS: typeof
|
|
4035
|
+
FS: typeof ZipFS;
|
|
3758
4036
|
/**
|
|
3759
4037
|
* The {@link ZipDirectoryEntry} constructor.
|
|
4038
|
+
*
|
|
4039
|
+
* @deprecated Use the {@link ZipDirectoryEntry} export instead.
|
|
3760
4040
|
*/
|
|
3761
4041
|
ZipDirectoryEntry: typeof ZipDirectoryEntry;
|
|
3762
4042
|
/**
|
|
3763
4043
|
* The {@link ZipFileEntry} constructor.
|
|
4044
|
+
*
|
|
4045
|
+
* @deprecated Use the {@link ZipFileEntry} export instead.
|
|
3764
4046
|
*/
|
|
3765
4047
|
ZipFileEntry: typeof ZipFileEntry;
|
|
3766
4048
|
};
|
|
@@ -3889,14 +4171,59 @@ export const ERR_INVALID_ENTRY_NAME: string;
|
|
|
3889
4171
|
* Invalid entry comment error
|
|
3890
4172
|
*/
|
|
3891
4173
|
export const ERR_INVALID_ENTRY_COMMENT: string;
|
|
4174
|
+
/**
|
|
4175
|
+
* Invalid entry comment type error
|
|
4176
|
+
*/
|
|
4177
|
+
export const ERR_INVALID_ENTRY_COMMENT_TYPE: string;
|
|
4178
|
+
/**
|
|
4179
|
+
* Invalid date error
|
|
4180
|
+
*/
|
|
4181
|
+
export const ERR_INVALID_DATE: string;
|
|
4182
|
+
/**
|
|
4183
|
+
* Invalid function option error
|
|
4184
|
+
*
|
|
4185
|
+
* @remarks
|
|
4186
|
+
* Thrown when an option expecting a function is given a value of another type: {@link ZipWriterConstructorOptions#encodeText},
|
|
4187
|
+
* {@link GetEntriesOptions#decodeText}, {@link ZipWriterConstructorOptions#createTempStream},
|
|
4188
|
+
* {@link ZipWriterCloseOptions#signCentralDirectory} and {@link GetEntriesOptions#decryptCentralDirectory}. It is also
|
|
4189
|
+
* thrown by {@link configure} for {@link Configuration#createWorker}, {@link Configuration#CompressionStream},
|
|
4190
|
+
* {@link Configuration#DecompressionStream}, {@link Configuration#CompressionStreamFallback} and
|
|
4191
|
+
* {@link Configuration#DecompressionStreamFallback}. A falsy value keeps meaning "use the default".
|
|
4192
|
+
*/
|
|
4193
|
+
export const ERR_INVALID_FUNCTION_OPTION: string;
|
|
4194
|
+
/**
|
|
4195
|
+
* Invalid signal error
|
|
4196
|
+
*
|
|
4197
|
+
* @remarks
|
|
4198
|
+
* Thrown when the `signal` option is not an `AbortSignal`. Any object exposing `addEventListener()` and a boolean `aborted`
|
|
4199
|
+
* property is accepted, so a signal coming from another realm keeps working.
|
|
4200
|
+
*/
|
|
4201
|
+
export const ERR_INVALID_SIGNAL: string;
|
|
4202
|
+
/**
|
|
4203
|
+
* Invalid maxWorkers error
|
|
4204
|
+
*
|
|
4205
|
+
* @remarks
|
|
4206
|
+
* Thrown by {@link configure} when {@link Configuration#maxWorkers} is not an integer greater than 0. A value lower than 1
|
|
4207
|
+
* used to deadlock {@link ZipWriter#add} for ever, since no entry could start and none could release the next one. Pass
|
|
4208
|
+
* {@link Configuration#useWebWorkers} set to `false` to compress and decompress data in the main thread instead.
|
|
4209
|
+
*/
|
|
4210
|
+
export const ERR_INVALID_MAX_WORKERS: string;
|
|
3892
4211
|
/**
|
|
3893
4212
|
* Invalid version error
|
|
3894
4213
|
*/
|
|
3895
4214
|
export const ERR_INVALID_VERSION: string;
|
|
4215
|
+
/**
|
|
4216
|
+
* Invalid extra field error
|
|
4217
|
+
*/
|
|
4218
|
+
export const ERR_INVALID_EXTRAFIELD: string;
|
|
3896
4219
|
/**
|
|
3897
4220
|
* Invalid extra field type error
|
|
3898
4221
|
*/
|
|
3899
4222
|
export const ERR_INVALID_EXTRAFIELD_TYPE: string;
|
|
4223
|
+
/**
|
|
4224
|
+
* Invalid extra field data type error
|
|
4225
|
+
*/
|
|
4226
|
+
export const ERR_INVALID_EXTRAFIELD_DATA_TYPE: string;
|
|
3900
4227
|
/**
|
|
3901
4228
|
* Invalid extra field data error
|
|
3902
4229
|
*/
|
|
@@ -3923,12 +4250,29 @@ export const ERR_UNSUPPORTED_FORMAT: string;
|
|
|
3923
4250
|
export const ERR_SPLIT_ZIP_FILE: string;
|
|
3924
4251
|
/**
|
|
3925
4252
|
* Overlapping entry error
|
|
4253
|
+
*
|
|
4254
|
+
* @remarks Thrown by {@link FileEntry#getData} when {@link ZipReaderOptions#checkOverlappingEntry} is set and the
|
|
4255
|
+
* data of the entry overlaps the data of an entry already read. The thrown error carries the other entry in its
|
|
4256
|
+
* `overlappingEntry` property.
|
|
3926
4257
|
*/
|
|
3927
4258
|
export const ERR_OVERLAPPING_ENTRY: string;
|
|
4259
|
+
/**
|
|
4260
|
+
* Entry data out of bounds error
|
|
4261
|
+
*
|
|
4262
|
+
* @remarks Thrown by {@link FileEntry#getData} when the declared extent of the entry data (i.e. its offset plus its compressed size) ends past the end of the zip file.
|
|
4263
|
+
*/
|
|
4264
|
+
export const ERR_ENTRY_DATA_OUT_OF_BOUNDS: string;
|
|
3928
4265
|
/**
|
|
3929
4266
|
* Ambiguous archive error
|
|
3930
4267
|
*
|
|
3931
|
-
* @remarks The thrown error carries a `reason` property describing the ambiguity: `"appended data"`,
|
|
4268
|
+
* @remarks The thrown error carries a `reason` property describing the ambiguity: `"appended data"`,
|
|
4269
|
+
* `"prepended data"`, `"trailing central directory data"`, `"multiple end of central directory records"`,
|
|
4270
|
+
* `"mismatched zip64 end of central directory record"`, `"duplicate filename"`, or, when
|
|
4271
|
+
* {@link ZipReaderOptions#checkLocalDirectory} compares the local header of an entry with its central
|
|
4272
|
+
* directory record, `"mismatched local file header (filename)"`,
|
|
4273
|
+
* `"mismatched local file header (general purpose bit flag)"`,
|
|
4274
|
+
* `"mismatched local file header (compression method)"` or
|
|
4275
|
+
* `"mismatched local file header (crc32 or sizes)"`.
|
|
3932
4276
|
*/
|
|
3933
4277
|
export const ERR_AMBIGUOUS_ARCHIVE: string;
|
|
3934
4278
|
/**
|
|
@@ -4023,7 +4367,9 @@ export const ERR_INVALID_LEVEL: string;
|
|
|
4023
4367
|
* Invalid password error (thrown when the `password` option is not a string, or the `rawPassword` option is not a `Uint8Array`)
|
|
4024
4368
|
*
|
|
4025
4369
|
* @remarks A value of another type would silently produce an unencrypted archive, and a `rawPassword` passed as a string
|
|
4026
|
-
* would produce an archive that cannot be opened with the equivalent {@link ZipWriterConstructorOptions#password}.
|
|
4370
|
+
* would produce an archive that cannot be opened with the equivalent {@link ZipWriterConstructorOptions#password}. The
|
|
4371
|
+
* reader applies the same check, where a value of another type used to fail with the unrelated {@link ERR_ENCRYPTED} or
|
|
4372
|
+
* {@link ERR_INVALID_PASSWORD}.
|
|
4027
4373
|
*/
|
|
4028
4374
|
export const ERR_INVALID_PASSWORD_TYPE: string;
|
|
4029
4375
|
/**
|
|
@@ -4036,6 +4382,16 @@ export const ERR_INVALID_PASSWORD_TYPE: string;
|
|
|
4036
4382
|
* or set the {@link ZipWriterAddDataOptions#uncompressedSize} option of each entry holding compressed data.
|
|
4037
4383
|
*/
|
|
4038
4384
|
export const ERR_INVALID_PASS_THROUGH: string;
|
|
4385
|
+
/**
|
|
4386
|
+
* Invalid readerOptions error (thrown by `{@link ZipDirectoryEntry}#export*()`,
|
|
4387
|
+
* {@link ZipDirectoryEntry#getExportedSize} and {@link ZipDirectoryEntry#exportFileSystemHandle} when the
|
|
4388
|
+
* {@link ZipDirectoryEntryExportOptions#readerOptions} option is neither an object nor unset)
|
|
4389
|
+
*
|
|
4390
|
+
* @remarks A value of another type was silently ignored: a password passed as a string instead of an object failed
|
|
4391
|
+
* with the unrelated {@link ERR_ENCRYPTED}, while the other options were dropped without any error. Note that an
|
|
4392
|
+
* unknown property of a `readerOptions` object is still ignored, as everywhere else in the API.
|
|
4393
|
+
*/
|
|
4394
|
+
export const ERR_INVALID_READER_OPTIONS: string;
|
|
4039
4395
|
/**
|
|
4040
4396
|
* Entry already exists error (thrown by the filesystem API when adding an entry whose filename already exists)
|
|
4041
4397
|
*/
|