@zip.js/zip.js 2.16.0 → 2.17.0
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/deno.json +1 -1
- package/dist/zip-core-external.js +429 -274
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +230 -151
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +580 -283
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +383 -160
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +580 -283
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +386 -163
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +583 -283
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +232 -153
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +233 -154
- 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 +430 -274
- package/dist/zip.min.js +1 -1
- package/eslint.config.mjs +1 -1
- package/index-native.cjs +386 -163
- package/index-native.min.js +1 -1
- package/index.cjs +583 -283
- package/index.d.cts +168 -29
- package/index.d.ts +168 -29
- package/index.min.js +1 -1
- package/lib/core/codec-pool.js +2 -0
- package/lib/core/codec-worker-web.js +11 -3
- package/lib/core/codec-worker.js +2 -1
- package/lib/core/streams/aes-crypto-stream.js +60 -17
- package/lib/core/streams/codec-stream.js +2 -0
- package/lib/core/streams/zip-crypto-stream.js +7 -7
- package/lib/core/streams/zip-entry-stream.js +130 -113
- package/lib/core/streams/zlib-js/zlib-streams.min.js +1 -1
- package/lib/core/streams/zlib-wasm/zlib-streams.js +199 -122
- package/lib/core/util/compatible-streams.js +10 -5
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +1 -1
- 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 +157 -10
- package/lib/core/zip-reader.js +8 -5
- package/lib/core/zip-writer.js +5 -2
- package/lib/zip-core-reader.js +1 -0
- package/package.json +3 -2
package/index.d.cts
CHANGED
|
@@ -2009,7 +2009,10 @@ export interface ZipReaderOptions {
|
|
|
2009
2009
|
*
|
|
2010
2010
|
* A signal already aborted when the operation starts rejects it with {@link ERR_ABORTED} as the
|
|
2011
2011
|
* reason of the `AbortError`, or with `signal.reason` when it is set, without relying on the
|
|
2012
|
-
* `signal` option of `pipeTo` that the oldest supported engines ignore.
|
|
2012
|
+
* `signal` option of `pipeTo` that the oldest supported engines ignore. A signal aborted while the
|
|
2013
|
+
* entry is being read rejects the operation as well, whether its compressed data is still being
|
|
2014
|
+
* consumed or its content still being written; on those engines, the content is written to the end
|
|
2015
|
+
* before the operation is rejected.
|
|
2013
2016
|
*/
|
|
2014
2017
|
signal?: AbortSignal;
|
|
2015
2018
|
/**
|
|
@@ -2440,13 +2443,21 @@ export interface EntryError extends Error {
|
|
|
2440
2443
|
* {@link GetEntriesOptions#strictness}. See {@link ERR_AMBIGUOUS_ARCHIVE} for the values it takes.
|
|
2441
2444
|
*/
|
|
2442
2445
|
reason?: string;
|
|
2446
|
+
/**
|
|
2447
|
+
* The related {@link ZipEntry} (filesystem API), set with {@link EntryError#entryId} and
|
|
2448
|
+
* {@link EntryError#entryName} when the data of an entry cannot be read while exporting. The error
|
|
2449
|
+
* is the one the reader of the entry raised, rethrown with its `cause` intact, e.g. the codec error
|
|
2450
|
+
* behind {@link ERR_INVALID_COMPRESSED_DATA} for an entry imported from a corrupted zip file.
|
|
2451
|
+
*/
|
|
2452
|
+
entry?: ZipEntry;
|
|
2443
2453
|
/**
|
|
2444
2454
|
* The id of the related {@link ZipEntry} (filesystem API).
|
|
2445
2455
|
*/
|
|
2446
2456
|
entryId?: number;
|
|
2447
2457
|
/**
|
|
2448
2458
|
* The name of the related {@link ZipEntry}, or of the related `FileSystemHandle` when importing
|
|
2449
|
-
* one (filesystem API). Set by
|
|
2459
|
+
* one (filesystem API), relative to the exported entry or to the parent of the handle. Set by the
|
|
2460
|
+
* export methods, {@link ZipDirectoryEntry#addFileSystemHandle} and
|
|
2450
2461
|
* {@link ZipDirectoryEntry#exportFileSystemHandle}, which rethrow the original error rather than
|
|
2451
2462
|
* wrapping it, so its `message` stays comparable to the exported `ERR_*` constants.
|
|
2452
2463
|
*/
|
|
@@ -2871,6 +2882,13 @@ export interface EntryGetDataOptions
|
|
|
2871
2882
|
*/
|
|
2872
2883
|
export interface EntryGetDataCheckPasswordOptions extends EntryGetDataOptions {}
|
|
2873
2884
|
|
|
2885
|
+
/**
|
|
2886
|
+
* Represents the options passed to `{@link ZipFileEntry}#get*()`.
|
|
2887
|
+
*/
|
|
2888
|
+
export interface ZipFileEntryGetDataOptions
|
|
2889
|
+
extends EntryGetDataOptions,
|
|
2890
|
+
PasswordCandidatesOptions {}
|
|
2891
|
+
|
|
2874
2892
|
/**
|
|
2875
2893
|
* Represents an instance used to create a zipped stream.
|
|
2876
2894
|
*
|
|
@@ -3408,7 +3426,10 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3408
3426
|
*
|
|
3409
3427
|
* A signal already aborted when the operation starts rejects it with {@link ERR_ABORTED} as the
|
|
3410
3428
|
* reason of the `AbortError`, or with `signal.reason` when it is set, without relying on the
|
|
3411
|
-
* `signal` option of `pipeTo` that the oldest supported engines ignore.
|
|
3429
|
+
* `signal` option of `pipeTo` that the oldest supported engines ignore. A signal aborted while the
|
|
3430
|
+
* entry is being added rejects the operation as well, whether its content is still being read or
|
|
3431
|
+
* its compressed data still being written; on those engines, the data is written to the end before
|
|
3432
|
+
* the operation is rejected.
|
|
3412
3433
|
*/
|
|
3413
3434
|
signal?: AbortSignal;
|
|
3414
3435
|
/**
|
|
@@ -3977,7 +3998,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
3977
3998
|
* @param options The options.
|
|
3978
3999
|
* @returns A promise resolving to a `string`.
|
|
3979
4000
|
*/
|
|
3980
|
-
getText(encoding?: string, options?:
|
|
4001
|
+
getText(encoding?: string, options?: ZipFileEntryGetDataOptions): Promise<string>;
|
|
3981
4002
|
/**
|
|
3982
4003
|
* Retrieves the content of the entry as a `Blob` instance
|
|
3983
4004
|
*
|
|
@@ -3985,7 +4006,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
3985
4006
|
* @param options The options.
|
|
3986
4007
|
* @returns A promise resolving to a `Blob` instance.
|
|
3987
4008
|
*/
|
|
3988
|
-
getBlob(mimeType?: string, options?:
|
|
4009
|
+
getBlob(mimeType?: string, options?: ZipFileEntryGetDataOptions): Promise<Blob>;
|
|
3989
4010
|
/**
|
|
3990
4011
|
* Retrieves the content of the entry as as a Data URI `string` encoded in Base64
|
|
3991
4012
|
*
|
|
@@ -3995,7 +4016,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
3995
4016
|
*/
|
|
3996
4017
|
getData64URI(
|
|
3997
4018
|
mimeType?: string,
|
|
3998
|
-
options?:
|
|
4019
|
+
options?: ZipFileEntryGetDataOptions
|
|
3999
4020
|
): Promise<string>;
|
|
4000
4021
|
/**
|
|
4001
4022
|
* Retrieves the content of the entry as a `Uint8Array` instance
|
|
@@ -4003,7 +4024,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
4003
4024
|
* @param options The options.
|
|
4004
4025
|
* @returns A promise resolving to a `Uint8Array` instance.
|
|
4005
4026
|
*/
|
|
4006
|
-
getUint8Array(options?:
|
|
4027
|
+
getUint8Array(options?: ZipFileEntryGetDataOptions): Promise<Uint8Array>;
|
|
4007
4028
|
/**
|
|
4008
4029
|
* Retrieves the content of the entry via a `WritableStream` instance
|
|
4009
4030
|
*
|
|
@@ -4013,7 +4034,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
4013
4034
|
*/
|
|
4014
4035
|
getWritable(
|
|
4015
4036
|
writable?: WritableStream,
|
|
4016
|
-
options?:
|
|
4037
|
+
options?: ZipFileEntryGetDataOptions
|
|
4017
4038
|
): Promise<WritableStream>;
|
|
4018
4039
|
/**
|
|
4019
4040
|
* Retrieves the content of the entry via a {@link Writer} instance
|
|
@@ -4028,7 +4049,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
4028
4049
|
| WritableWriter
|
|
4029
4050
|
| WritableStream
|
|
4030
4051
|
| AsyncGenerator<Writer<unknown> | WritableWriter | WritableStream>,
|
|
4031
|
-
options?:
|
|
4052
|
+
options?: ZipFileEntryGetDataOptions
|
|
4032
4053
|
): Promise<Type>;
|
|
4033
4054
|
/**
|
|
4034
4055
|
* Retrieves the content of the entry as an `ArrayBuffer` instance
|
|
@@ -4036,7 +4057,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
4036
4057
|
* @param options The options.
|
|
4037
4058
|
* @returns A promise resolving to an `ArrayBuffer` instance.
|
|
4038
4059
|
*/
|
|
4039
|
-
getArrayBuffer(options?:
|
|
4060
|
+
getArrayBuffer(options?: ZipFileEntryGetDataOptions): Promise<ArrayBuffer>;
|
|
4040
4061
|
/**
|
|
4041
4062
|
* Replaces the content of the entry with a `Blob` instance
|
|
4042
4063
|
*
|
|
@@ -4510,11 +4531,89 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4510
4531
|
getExportedSize(options?: ZipDirectoryEntryExportOptions): Promise<number>;
|
|
4511
4532
|
}
|
|
4512
4533
|
|
|
4534
|
+
/**
|
|
4535
|
+
* Represents the options supplying several passwords to the entries imported from a zip file, tried in
|
|
4536
|
+
* order when an entry is read.
|
|
4537
|
+
*
|
|
4538
|
+
* @remarks
|
|
4539
|
+
* The core API takes one password per reader or per call. The filesystem API adds a list of
|
|
4540
|
+
* candidates and a function asked for a password when the candidates fail, because it reads each
|
|
4541
|
+
* entry into memory before using it and can therefore try again. The candidates are tried in this
|
|
4542
|
+
* order: the {@link ZipReaderOptions#password} or {@link ZipReaderOptions#rawPassword} option,
|
|
4543
|
+
* then the passwords that already decrypted an entry of the same imported zip file, most recent first,
|
|
4544
|
+
* then the {@link PasswordCandidatesOptions#passwords} option. Each candidate is tried once per entry,
|
|
4545
|
+
* and the entries of a zip file overwhelmingly share one password, so an archive costs one extra
|
|
4546
|
+
* attempt per wrong candidate ahead of the right one, and not one per entry.
|
|
4547
|
+
*
|
|
4548
|
+
* A candidate is rejected when the entry raises an {@link ERR_INVALID_PASSWORD} error, which both
|
|
4549
|
+
* encryption methods do on the first bytes of the entry, before any content is produced. An entry
|
|
4550
|
+
* encrypted with ZipCrypto verifies the password on a single byte, so one wrong password in 256 passes
|
|
4551
|
+
* that check and fails while reading the content instead: for such entries the password is first
|
|
4552
|
+
* verified alone, the CRC32 of the content is then checked whatever the {@link ZipReaderOptions#checkCrc32}
|
|
4553
|
+
* option says, and a read failing with an {@link ERR_INVALID_CRC32}, {@link ERR_INVALID_COMPRESSED_DATA}
|
|
4554
|
+
* or {@link ERR_INVALID_UNCOMPRESSED_SIZE} error is treated as a wrong password and the next candidate is
|
|
4555
|
+
* tried. Any other failure, e.g. a failure of the reader or an {@link ERR_CODEC_OUT_OF_MEMORY} error, is
|
|
4556
|
+
* reported as-is. A corrupted entry read with the right password is reported as a wrong password too,
|
|
4557
|
+
* since nothing tells it from a wrong password passing the check. An entry encrypted with AES verifies
|
|
4558
|
+
* the password on two bytes, so a failure of the read that follows is reported as-is, e.g. as an
|
|
4559
|
+
* {@link ERR_INVALID_AUTHENTICATION_CODE} error.
|
|
4560
|
+
*
|
|
4561
|
+
* The options are set when importing the zip file, in the {@link ZipDirectoryEntryExportOptions#readerOptions}
|
|
4562
|
+
* option of an export, and when reading one entry with `{@link ZipFileEntry}#get*()`. They apply to the
|
|
4563
|
+
* entries imported from a zip file only, and never to the entries read as-is with the
|
|
4564
|
+
* {@link ZipReaderOptions#passThrough} option, which are not decrypted.
|
|
4565
|
+
*/
|
|
4566
|
+
export interface PasswordCandidatesOptions {
|
|
4567
|
+
/**
|
|
4568
|
+
* The passwords tried in order, after the {@link ZipReaderOptions#password} option and the
|
|
4569
|
+
* passwords already accepted by another entry of the same imported zip file. An empty string is
|
|
4570
|
+
* ignored.
|
|
4571
|
+
*
|
|
4572
|
+
* When every candidate fails, the entry raises an {@link ERR_INVALID_PASSWORD} error whose `cause` is
|
|
4573
|
+
* the error raised by the last candidate, unless the {@link PasswordCandidatesOptions#requestPassword}
|
|
4574
|
+
* option is set.
|
|
4575
|
+
*
|
|
4576
|
+
* A value which is neither an array of strings nor unset throws an {@link ERR_INVALID_PASSWORDS}
|
|
4577
|
+
* error.
|
|
4578
|
+
*/
|
|
4579
|
+
passwords?: string[];
|
|
4580
|
+
/**
|
|
4581
|
+
* The function asked for a password when every candidate has failed, or when there is none. It is
|
|
4582
|
+
* called with the entry being read and with the error raised by the last candidate, which is
|
|
4583
|
+
* `undefined` when no candidate was tried, and it can return a promise, e.g. when it prompts the user.
|
|
4584
|
+
*
|
|
4585
|
+
* A string is tried on the entry, and the function is called again when it fails, with the
|
|
4586
|
+
* {@link ERR_INVALID_PASSWORD} error. `undefined` or `null` gives up: the entry raises an
|
|
4587
|
+
* {@link ERR_INVALID_PASSWORD} error whose `cause` is the error raised by the last candidate, or an
|
|
4588
|
+
* {@link ERR_ENCRYPTED} error when no candidate was tried. A value of another type throws an
|
|
4589
|
+
* {@link ERR_INVALID_REQUEST_PASSWORD} error. The
|
|
4590
|
+
* function is not called for the entries whose password is already known.
|
|
4591
|
+
*
|
|
4592
|
+
* When several entries are read concurrently, e.g. by `{@link ZipDirectoryEntry}#export*()` with the
|
|
4593
|
+
* {@link ZipWriterConstructorOptions#bufferedWrite} option, only one call is pending at a time: the
|
|
4594
|
+
* other entries wait for its answer and try it before asking themselves. Cancelling the whole
|
|
4595
|
+
* operation from the function is done with the {@link ZipReaderOptions#signal} option, since giving
|
|
4596
|
+
* up fails the entry being read only.
|
|
4597
|
+
*
|
|
4598
|
+
* A value which is neither a function nor unset throws an {@link ERR_INVALID_REQUEST_PASSWORD}
|
|
4599
|
+
* error.
|
|
4600
|
+
*
|
|
4601
|
+
* @param entry The entry being read.
|
|
4602
|
+
* @param error The error raised by the last candidate, `undefined` when no candidate was tried.
|
|
4603
|
+
* @returns The password to try, or `undefined` to give up.
|
|
4604
|
+
*/
|
|
4605
|
+
requestPassword?(
|
|
4606
|
+
entry: FileEntry,
|
|
4607
|
+
error?: Error
|
|
4608
|
+
): Promise<string | undefined | null> | string | undefined | null;
|
|
4609
|
+
}
|
|
4610
|
+
|
|
4513
4611
|
/**
|
|
4514
4612
|
* Represents the options passed to `{@link ZipDirectoryEntry}#import*()`.
|
|
4515
4613
|
*/
|
|
4516
4614
|
export interface ZipDirectoryEntryImportOptions
|
|
4517
|
-
extends Omit<ZipReaderConstructorOptions, "passThrough"
|
|
4615
|
+
extends Omit<ZipReaderConstructorOptions, "passThrough">,
|
|
4616
|
+
PasswordCandidatesOptions {
|
|
4518
4617
|
/**
|
|
4519
4618
|
* `true` to import the entries of the zip file as-is, without decompressing and decrypting them
|
|
4520
4619
|
*
|
|
@@ -4532,10 +4631,10 @@ export interface ZipDirectoryEntryImportOptions
|
|
|
4532
4631
|
* path components ignored when building the tree (e.g. `"a/b.txt"` and `"./a/b.txt"`), or one can be
|
|
4533
4632
|
* a file and the other a directory holding it (e.g. `"a"` and `"a/b.txt"`).
|
|
4534
4633
|
*
|
|
4535
|
-
* `"throw"` refuses the zip file with an {@link ERR_DUPLICATE_IMPORTED_ENTRY} error, whose
|
|
4536
|
-
* property holds the {@link EntryMetaData} instance of the entry that could not be
|
|
4537
|
-
* filesystem is left unchanged, i.e. the entries imported before the error are
|
|
4538
|
-
* content held before the import is restored.
|
|
4634
|
+
* `"throw"` refuses the zip file with an {@link ERR_DUPLICATE_IMPORTED_ENTRY} error, whose
|
|
4635
|
+
* `cause.entry` property holds the {@link EntryMetaData} instance of the entry that could not be
|
|
4636
|
+
* imported. The filesystem is left unchanged, i.e. the entries imported before the error are
|
|
4637
|
+
* removed and the content held before the import is restored.
|
|
4539
4638
|
*
|
|
4540
4639
|
* `"keep-first"` ignores the entry claiming a node already taken, and `"keep-last"` replaces the
|
|
4541
4640
|
* entry holding the node, which is the behavior of most zip tools. The entries that do not collide
|
|
@@ -4689,7 +4788,7 @@ export interface ZipDirectoryEntryExportOptions
|
|
|
4689
4788
|
*
|
|
4690
4789
|
* A value which is neither an object nor unset throws an {@link ERR_INVALID_READER_OPTIONS} error.
|
|
4691
4790
|
*/
|
|
4692
|
-
readerOptions?: Omit<ZipReaderConstructorOptions, "passThrough"> & { passThrough?: boolean };
|
|
4791
|
+
readerOptions?: Omit<ZipReaderConstructorOptions, "passThrough"> & { passThrough?: boolean } & PasswordCandidatesOptions;
|
|
4693
4792
|
}
|
|
4694
4793
|
|
|
4695
4794
|
/**
|
|
@@ -4700,7 +4799,8 @@ export interface ZipDirectoryEntryExportOptions
|
|
|
4700
4799
|
* file it creates and must close it for the data to be written.
|
|
4701
4800
|
*/
|
|
4702
4801
|
export interface ZipDirectoryEntryExportFileSystemHandleOptions
|
|
4703
|
-
extends EntryGetDataOptions
|
|
4802
|
+
extends EntryGetDataOptions,
|
|
4803
|
+
PasswordCandidatesOptions {
|
|
4704
4804
|
/**
|
|
4705
4805
|
* `true` to write independent files concurrently instead of one after another.
|
|
4706
4806
|
*
|
|
@@ -4722,7 +4822,7 @@ export interface ZipDirectoryEntryExportFileSystemHandleOptions
|
|
|
4722
4822
|
*
|
|
4723
4823
|
* A value which is neither an object nor unset throws an {@link ERR_INVALID_READER_OPTIONS} error.
|
|
4724
4824
|
*/
|
|
4725
|
-
readerOptions?: Omit<ZipReaderConstructorOptions, "passThrough"> & { passThrough?: boolean };
|
|
4825
|
+
readerOptions?: Omit<ZipReaderConstructorOptions, "passThrough"> & { passThrough?: boolean } & PasswordCandidatesOptions;
|
|
4726
4826
|
}
|
|
4727
4827
|
|
|
4728
4828
|
/**
|
|
@@ -4918,6 +5018,12 @@ export const ERR_INVALID_CODEC_MODULE: string;
|
|
|
4918
5018
|
/**
|
|
4919
5019
|
* Invalid CRC-32 checksum error, thrown when the {@link ZipReaderOptions#checkCrc32} option is set and the CRC-32
|
|
4920
5020
|
* checksum of an entry does not match the value stored in the zip file.
|
|
5021
|
+
*
|
|
5022
|
+
* @remarks
|
|
5023
|
+
* When the inflater verifies the checksum itself, through a gzip trailer that zip.js builds from the stored
|
|
5024
|
+
* CRC-32 and uncompressed size, it rejects the trailer as a whole and its error is kept as the `cause`. A
|
|
5025
|
+
* stored uncompressed size larger than the data therefore raises this error too on that route, whereas a
|
|
5026
|
+
* stored size smaller than the data raises {@link ERR_INVALID_UNCOMPRESSED_SIZE} on every route.
|
|
4921
5027
|
*/
|
|
4922
5028
|
export const ERR_INVALID_CRC32: string;
|
|
4923
5029
|
/**
|
|
@@ -4926,24 +5032,44 @@ export const ERR_INVALID_CRC32: string;
|
|
|
4926
5032
|
*/
|
|
4927
5033
|
export const ERR_INVALID_AUTHENTICATION_CODE: string;
|
|
4928
5034
|
/**
|
|
4929
|
-
* Invalid uncompressed size error
|
|
5035
|
+
* Invalid uncompressed size error, thrown when an entry inflates to more bytes than its stored uncompressed size.
|
|
5036
|
+
*
|
|
5037
|
+
* @remarks
|
|
5038
|
+
* An entry encrypted with AES that stores no CRC-32 (AE-2) and inflated through a gzip container, on a host
|
|
5039
|
+
* whose inflater lacks `"deflate-raw"`, raises this error when it inflates to fewer bytes as well, since the
|
|
5040
|
+
* end of its data is told by the stored size alone.
|
|
4930
5041
|
*/
|
|
4931
5042
|
export const ERR_INVALID_UNCOMPRESSED_SIZE: string;
|
|
4932
5043
|
/**
|
|
4933
|
-
* Invalid compressed data error
|
|
5044
|
+
* Invalid compressed data error, thrown when the codec rejects the compressed data of an entry.
|
|
4934
5045
|
*
|
|
4935
5046
|
* @remarks
|
|
4936
|
-
* The
|
|
4937
|
-
*
|
|
4938
|
-
*
|
|
4939
|
-
*
|
|
4940
|
-
*
|
|
4941
|
-
*
|
|
4942
|
-
*
|
|
4943
|
-
*
|
|
4944
|
-
*
|
|
5047
|
+
* The error is the same whatever inflates the data, and the error the codec raised is kept as its
|
|
5048
|
+
* `cause`: the `TypeError` of a native `DecompressionStream`, whose message depends on the engine,
|
|
5049
|
+
* or the error of the bundled WASM or pure-JS codec. An error raised while reading the data, e.g.
|
|
5050
|
+
* by the reader of the zip file or by the decryption of the entry, is not a codec failure and
|
|
5051
|
+
* reaches the caller unchanged.
|
|
5052
|
+
*
|
|
5053
|
+
* Bytes trailing a complete DEFLATE stream (e.g. a wrong `compressedSize`) are rejected by every
|
|
5054
|
+
* codec, the native `DecompressionStream` (on Node.js, with `ERR_TRAILING_JUNK_AFTER_STREAM_END`
|
|
5055
|
+
* as the `code` of the cause) and the bundled WASM and pure-JS codecs alike. Any data that is
|
|
5056
|
+
* returned is always validated against the entry's uncompressed size (and CRC when
|
|
5057
|
+
* {@link ZipReaderOptions#checkCrc32} is set), so it is never silently truncated.
|
|
4945
5058
|
*/
|
|
4946
5059
|
export const ERR_INVALID_COMPRESSED_DATA: string;
|
|
5060
|
+
/**
|
|
5061
|
+
* Codec out of memory error, thrown when the codec of an entry cannot allocate the memory it needs, e.g. when
|
|
5062
|
+
* the fixed heap of the bundled WASM module is exhausted by too many entries processed concurrently in the same
|
|
5063
|
+
* scope.
|
|
5064
|
+
*
|
|
5065
|
+
* @remarks
|
|
5066
|
+
* The error the codec raised is kept as the `cause`. The failure is recognized by the `code` property of that
|
|
5067
|
+
* error, `"Z_MEM_ERROR"`, which the bundled WASM codec sets and the native `DecompressionStream` of Node.js
|
|
5068
|
+
* would set; a codec reporting the failure without it is reported as {@link ERR_INVALID_COMPRESSED_DATA} when
|
|
5069
|
+
* reading, or with its own error when writing. When writing, only a codec that fails to allocate its state is
|
|
5070
|
+
* reported with this error: a failure while compressing keeps the error of the codec.
|
|
5071
|
+
*/
|
|
5072
|
+
export const ERR_CODEC_OUT_OF_MEMORY: string;
|
|
4947
5073
|
/**
|
|
4948
5074
|
* Invalid password error
|
|
4949
5075
|
*/
|
|
@@ -5276,6 +5402,19 @@ export const ERR_UNSUPPORTED_PASS_THROUGH_VALUE: string;
|
|
|
5276
5402
|
* unknown property of a `readerOptions` object is still ignored, as everywhere else in the API.
|
|
5277
5403
|
*/
|
|
5278
5404
|
export const ERR_INVALID_READER_OPTIONS: string;
|
|
5405
|
+
/**
|
|
5406
|
+
* Invalid passwords error (thrown by `{@link ZipDirectoryEntry}#import*()`, `{@link ZipDirectoryEntry}#export*()`,
|
|
5407
|
+
* {@link ZipDirectoryEntry#exportFileSystemHandle} and `{@link ZipFileEntry}#get*()` when the
|
|
5408
|
+
* {@link PasswordCandidatesOptions#passwords} option is neither an array of strings nor unset)
|
|
5409
|
+
*/
|
|
5410
|
+
export const ERR_INVALID_PASSWORDS: string;
|
|
5411
|
+
/**
|
|
5412
|
+
* Invalid requestPassword error (thrown by `{@link ZipDirectoryEntry}#import*()`, `{@link ZipDirectoryEntry}#export*()`,
|
|
5413
|
+
* {@link ZipDirectoryEntry#exportFileSystemHandle} and `{@link ZipFileEntry}#get*()` when the
|
|
5414
|
+
* {@link PasswordCandidatesOptions#requestPassword} option is neither a function nor unset, and when it returns a
|
|
5415
|
+
* value which is neither a string, `undefined` nor `null`)
|
|
5416
|
+
*/
|
|
5417
|
+
export const ERR_INVALID_REQUEST_PASSWORD: string;
|
|
5279
5418
|
/**
|
|
5280
5419
|
* Invalid entry error (thrown by {@link ZipWriter#add} when the {@link ZipWriterAddDataOptions#entry} option is
|
|
5281
5420
|
* neither an entry nor unset)
|