@zip.js/zip.js 2.8.58 → 2.8.60
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 +2 -2
- package/dist/zip-core-external.js +295 -57
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +286 -40
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +295 -58
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +5867 -4360
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +295 -58
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +288 -43
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +313 -58
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +288 -42
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +288 -42
- 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 +313 -57
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +288 -43
- package/index-native.min.js +1 -1
- package/index.cjs +313 -58
- package/index.d.cts +318 -2
- package/index.d.ts +318 -2
- package/index.min.js +1 -1
- package/lib/core/codec-registry.js +5 -0
- package/lib/core/compression-methods.js +93 -0
- package/lib/core/constants.js +2 -0
- package/lib/core/options.js +2 -0
- package/lib/core/streams/zip-entry-stream.js +7 -3
- package/lib/core/streams/zlib-wasm/zlib-streams.js +18 -8
- package/lib/core/version.js +31 -0
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/zip-reader.js +143 -33
- package/lib/core/zip-writer.js +14 -6
- package/lib/zip-core-base.js +7 -0
- package/lib/zip-core-reader.js +16 -1
- package/lib/zip-fs-core.js +32 -0
- package/package.json +3 -3
- package/sync-versions.js +26 -0
package/index.d.cts
CHANGED
|
@@ -216,6 +216,12 @@ declare class DecompressionStreamLike extends TransformStreamLike {
|
|
|
216
216
|
constructor(format: string, options?: DecompressionStreamOptions);
|
|
217
217
|
}
|
|
218
218
|
|
|
219
|
+
/**
|
|
220
|
+
* The version of zip.js (e.g. `"2.8.59"`), i.e. the `version` declared in the `package.json` file
|
|
221
|
+
* of the library.
|
|
222
|
+
*/
|
|
223
|
+
export const VERSION: string;
|
|
224
|
+
|
|
219
225
|
/**
|
|
220
226
|
* Configures zip.js
|
|
221
227
|
*
|
|
@@ -247,6 +253,61 @@ export function registerCodec(codec: CodecDefinition): void;
|
|
|
247
253
|
*/
|
|
248
254
|
export function unregisterCodec(compressionMethod: number): void;
|
|
249
255
|
|
|
256
|
+
/**
|
|
257
|
+
* Returns the definitions of the codecs registered with {@link registerCodec}, in registration
|
|
258
|
+
* order. The returned objects are snapshots: modifying them does not alter the registered codecs.
|
|
259
|
+
*
|
|
260
|
+
* @remarks
|
|
261
|
+
* The `CompressionStream` and `DecompressionStream` classes of a codec registered with
|
|
262
|
+
* {@link CodecDefinition#codecURI} only appear once the module has been imported, i.e. after the
|
|
263
|
+
* first entry using the codec has been read or written.
|
|
264
|
+
*
|
|
265
|
+
* @returns The codec definitions.
|
|
266
|
+
*/
|
|
267
|
+
export function getRegisteredCodecs(): CodecDefinition[];
|
|
268
|
+
|
|
269
|
+
/**
|
|
270
|
+
* Returns the compression methods supported in the current environment and configuration: the
|
|
271
|
+
* built-in methods followed by the codecs registered with {@link registerCodec}, in registration
|
|
272
|
+
* order.
|
|
273
|
+
*
|
|
274
|
+
* @remarks
|
|
275
|
+
* The support of the built-in methods is resolved against the compression streams available when
|
|
276
|
+
* the function is called, i.e. the classes set with {@link configure} and the implementations
|
|
277
|
+
* embedded in the build. A caller can test whether an entry is readable by looking up
|
|
278
|
+
* {@link EntryMetaData#compressionMethod} in the result and checking
|
|
279
|
+
* {@link EntryMetaData#encrypted}; `FileEntry#getData` remains the authority.
|
|
280
|
+
*
|
|
281
|
+
* @returns The supported compression methods.
|
|
282
|
+
*/
|
|
283
|
+
export function getSupportedCompressionMethods(): SupportedCompressionMethod[];
|
|
284
|
+
|
|
285
|
+
/**
|
|
286
|
+
* Represents the support of a compression method, see {@link getSupportedCompressionMethods}.
|
|
287
|
+
*/
|
|
288
|
+
export interface SupportedCompressionMethod {
|
|
289
|
+
/**
|
|
290
|
+
* The compression method stored in zip entry headers (e.g. `8` for Deflate).
|
|
291
|
+
*/
|
|
292
|
+
compressionMethod: number;
|
|
293
|
+
/**
|
|
294
|
+
* `true` if entries can be compressed with the method. It is `undefined` when the support is
|
|
295
|
+
* unknown, i.e. for a codec registered with {@link CodecDefinition#codecURI} whose module has not
|
|
296
|
+
* been imported yet.
|
|
297
|
+
*/
|
|
298
|
+
compression?: boolean;
|
|
299
|
+
/**
|
|
300
|
+
* `true` if entries can be decompressed with the method. It is `undefined` when the support is
|
|
301
|
+
* unknown, i.e. for a codec registered with {@link CodecDefinition#codecURI} whose module has not
|
|
302
|
+
* been imported yet.
|
|
303
|
+
*/
|
|
304
|
+
decompression?: boolean;
|
|
305
|
+
/**
|
|
306
|
+
* `true` if the method comes from a codec registered with {@link registerCodec}.
|
|
307
|
+
*/
|
|
308
|
+
registered: boolean;
|
|
309
|
+
}
|
|
310
|
+
|
|
250
311
|
/**
|
|
251
312
|
* Represents a codec definition passed to {@link registerCodec}.
|
|
252
313
|
*/
|
|
@@ -310,6 +371,13 @@ export interface CompressionStreamOptions {
|
|
|
310
371
|
* It is only set for the codecs registered with {@link registerCodec}.
|
|
311
372
|
*/
|
|
312
373
|
compressionMethod?: number;
|
|
374
|
+
/**
|
|
375
|
+
* The uncompressed size of the entry, undefined when the size is unknown.
|
|
376
|
+
* It allows codecs such as Zstandard to include the content size in the compressed frame.
|
|
377
|
+
*
|
|
378
|
+
* It is only set for the codecs registered with {@link registerCodec}.
|
|
379
|
+
*/
|
|
380
|
+
uncompressedSize?: number;
|
|
313
381
|
}
|
|
314
382
|
|
|
315
383
|
/**
|
|
@@ -757,6 +825,48 @@ export interface ReadableReader {
|
|
|
757
825
|
* }
|
|
758
826
|
* }
|
|
759
827
|
* ```
|
|
828
|
+
*
|
|
829
|
+
* @example
|
|
830
|
+
* Reading a file on the filesystem with random access does not always require a custom {@link Reader}:
|
|
831
|
+
* on runtimes exposing files as lazily-read `Blob` instances, the `Blob` returned by
|
|
832
|
+
* `await fs.openAsBlob(path)` on Node.js or `Bun.file(path)` on Bun can be passed directly to
|
|
833
|
+
* {@link ZipReader}. Deno has no equivalent API yet, see https://github.com/denoland/deno/issues/32316.
|
|
834
|
+
* The class below reads a
|
|
835
|
+
* `Deno.FsFile` with random access instead of buffering it entirely in memory. The `seek()` and `read()`
|
|
836
|
+
* calls are serialized in a queue because zip.js can read multiple byte ranges concurrently:
|
|
837
|
+
* ```
|
|
838
|
+
* class FsFileReader extends Reader {
|
|
839
|
+
*
|
|
840
|
+
* constructor(file) {
|
|
841
|
+
* super();
|
|
842
|
+
* this.file = file;
|
|
843
|
+
* this.queue = Promise.resolve();
|
|
844
|
+
* }
|
|
845
|
+
*
|
|
846
|
+
* async init() {
|
|
847
|
+
* super.init();
|
|
848
|
+
* this.size = (await this.file.stat()).size;
|
|
849
|
+
* }
|
|
850
|
+
*
|
|
851
|
+
* readUint8Array(offset, length) {
|
|
852
|
+
* const result = this.queue.then(async () => {
|
|
853
|
+
* await this.file.seek(offset, Deno.SeekMode.Start);
|
|
854
|
+
* const data = new Uint8Array(length);
|
|
855
|
+
* let bytesRead = 0;
|
|
856
|
+
* while (bytesRead < length) {
|
|
857
|
+
* const count = await this.file.read(data.subarray(bytesRead));
|
|
858
|
+
* if (count === null) {
|
|
859
|
+
* return data.subarray(0, bytesRead);
|
|
860
|
+
* }
|
|
861
|
+
* bytesRead += count;
|
|
862
|
+
* }
|
|
863
|
+
* return data;
|
|
864
|
+
* });
|
|
865
|
+
* this.queue = result.catch(() => undefined);
|
|
866
|
+
* return result;
|
|
867
|
+
* }
|
|
868
|
+
* }
|
|
869
|
+
* ```
|
|
760
870
|
*/
|
|
761
871
|
export class Reader<Type> implements Initializable, ReadableReader {
|
|
762
872
|
/**
|
|
@@ -1286,7 +1396,9 @@ export class ZipReader<Type> {
|
|
|
1286
1396
|
* file is read first. A `ReadableStream` instance, or an object providing only a `readable` property
|
|
1287
1397
|
* (e.g. a file handle), is therefore buffered entirely in memory when the instance is initialized. To
|
|
1288
1398
|
* read a large seekable resource without buffering it, pass a custom {@link Reader} implementation
|
|
1289
|
-
* that reads the requested byte ranges directly
|
|
1399
|
+
* that reads the requested byte ranges directly, or a lazily-read `Blob` instance when the runtime
|
|
1400
|
+
* provides one, e.g. `await fs.openAsBlob(path)` on Node.js or `Bun.file(path)` on Bun. See
|
|
1401
|
+
* {@link Reader} for an example reading a `Deno.FsFile` with random access.
|
|
1290
1402
|
*
|
|
1291
1403
|
* @param reader The {@link Reader} instance used to read data.
|
|
1292
1404
|
* @param options The options.
|
|
@@ -1341,6 +1453,31 @@ export class ZipReader<Type> {
|
|
|
1341
1453
|
* `6 + digitalSignature.length` from it when the record is stored inside the declared range.
|
|
1342
1454
|
*/
|
|
1343
1455
|
directoryLength?: number;
|
|
1456
|
+
/**
|
|
1457
|
+
* The non-fatal diagnostics deposited while reading the entries, replaced every time
|
|
1458
|
+
* {@link ZipReader#getEntries} or {@link ZipReader#getEntriesGenerator} runs.
|
|
1459
|
+
*
|
|
1460
|
+
* @remarks
|
|
1461
|
+
* A warning reports a characteristic of the zip file observed in data the parse had already read: depositing
|
|
1462
|
+
* one never costs additional I/O, and a well-formed zip file deposits none. Each
|
|
1463
|
+
* {@link ArchiveWarning#reason} value is deposited at most once per call, with
|
|
1464
|
+
* {@link ArchiveWarning#filename} naming the first entry it applies to when it applies to an entry.
|
|
1465
|
+
*
|
|
1466
|
+
* Two kinds of reasons are deposited. Observations are always non-fatal: {@link WARNING_UNSORTED_CENTRAL_DIRECTORY},
|
|
1467
|
+
* {@link WARNING_UNKNOWN_VERSION} (the low byte of the "version needed to extract" field exceeds the highest
|
|
1468
|
+
* known zip specification version; the high byte is ignored because some writers store a host identifier in it),
|
|
1469
|
+
* {@link WARNING_COMPRESSED_PATCHED_DATA} (bit 5 of the general purpose bit flag),
|
|
1470
|
+
* {@link WARNING_MALFORMED_EXTRA_FIELD}, {@link WARNING_UNKNOWN_ZIP64_EXTENSIBLE_DATA} and
|
|
1471
|
+
* {@link WARNING_WRAPPED_ENTRIES_COUNT}. The other reasons are the checks that
|
|
1472
|
+
* `strictness: "strict"` rejects with {@link ERR_AMBIGUOUS_ARCHIVE}: when the effective strictness tolerates
|
|
1473
|
+
* one of them and the evidence is already in hand, the same reason string is deposited as a warning instead —
|
|
1474
|
+
* {@link WARNING_APPENDED_DATA}, {@link WARNING_PREPENDED_DATA}, {@link WARNING_TRAILING_CENTRAL_DIRECTORY_DATA},
|
|
1475
|
+
* {@link WARNING_DUPLICATE_FILENAME} and {@link WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY}.
|
|
1476
|
+
*
|
|
1477
|
+
* The warnings related to the local file header of an entry are deposited on
|
|
1478
|
+
* {@link EntryMetaData#warnings} when its data is read, not here.
|
|
1479
|
+
*/
|
|
1480
|
+
warnings?: ArchiveWarning[];
|
|
1344
1481
|
/**
|
|
1345
1482
|
* Returns all the entries in the zip file
|
|
1346
1483
|
*
|
|
@@ -1369,6 +1506,58 @@ export class ZipReader<Type> {
|
|
|
1369
1506
|
close(): Promise<void>;
|
|
1370
1507
|
}
|
|
1371
1508
|
|
|
1509
|
+
/**
|
|
1510
|
+
* Returns `true` if the data looks like a zip file, i.e. if {@link ZipReader#getEntries} called on the same
|
|
1511
|
+
* data with the same options would locate the archive structure instead of throwing
|
|
1512
|
+
* {@link ERR_EOCDR_NOT_FOUND} or the {@link ERR_AMBIGUOUS_ARCHIVE} error caused by appended data.
|
|
1513
|
+
*
|
|
1514
|
+
* @remarks
|
|
1515
|
+
* The probe runs the same search as {@link ZipReader}: it locates the end of central directory record with
|
|
1516
|
+
* the end-anchored backward scan and verifies that a central directory record is stored where it points,
|
|
1517
|
+
* without parsing the entries. `true` therefore means the data is a plausible zip container, not that every
|
|
1518
|
+
* entry can be read: a truncated or otherwise damaged central directory is only detected by calling
|
|
1519
|
+
* {@link ZipReader#getEntries}. Formats built on zip, e.g. office documents or Java archives, return `true`.
|
|
1520
|
+
*
|
|
1521
|
+
* Like the {@link ZipReader} constructor, a `ReadableStream` or an object providing only a `readable`
|
|
1522
|
+
* property is buffered entirely in memory before probing, which defeats the purpose of a cheap probe; prefer
|
|
1523
|
+
* a seekable {@link Reader} input.
|
|
1524
|
+
*
|
|
1525
|
+
* @param reader The {@link Reader} instance used to read data.
|
|
1526
|
+
* @param options The options.
|
|
1527
|
+
* @returns A promise resolving to `true` if the data looks like a zip file.
|
|
1528
|
+
*/
|
|
1529
|
+
export function isZipFile(
|
|
1530
|
+
reader:
|
|
1531
|
+
| Reader<unknown>
|
|
1532
|
+
| ReadableReader
|
|
1533
|
+
| ReadableStream
|
|
1534
|
+
| Reader<unknown>[]
|
|
1535
|
+
| ReadableReader[]
|
|
1536
|
+
| ReadableStream[],
|
|
1537
|
+
options?: IsZipFileOptions
|
|
1538
|
+
): Promise<boolean>;
|
|
1539
|
+
|
|
1540
|
+
/**
|
|
1541
|
+
* Represents the options passed to {@link isZipFile}.
|
|
1542
|
+
*/
|
|
1543
|
+
export interface IsZipFileOptions {
|
|
1544
|
+
/**
|
|
1545
|
+
* The tolerance of the probe, with the same semantics and default as
|
|
1546
|
+
* {@link ZipReaderConstructorOptions#strictness}: it selects the default amount of tolerated appended data
|
|
1547
|
+
* (0 for `"strict"`, 65536 bytes for `"balanced"`, unlimited for `"tolerant"`) and `"strict"` also returns
|
|
1548
|
+
* `false` when multiple end of central directory records reach the end of the data.
|
|
1549
|
+
*
|
|
1550
|
+
* @defaultValue "balanced"
|
|
1551
|
+
*/
|
|
1552
|
+
strictness?: "strict" | "balanced" | "tolerant";
|
|
1553
|
+
/**
|
|
1554
|
+
* The maximum number of bytes tolerated after the end of central directory record, overriding the default
|
|
1555
|
+
* selected by {@link IsZipFileOptions#strictness}, with the same semantics as
|
|
1556
|
+
* {@link ZipReaderConstructorOptions#maxAppendedDataSize}.
|
|
1557
|
+
*/
|
|
1558
|
+
maxAppendedDataSize?: number;
|
|
1559
|
+
}
|
|
1560
|
+
|
|
1372
1561
|
/**
|
|
1373
1562
|
* Represents the options passed to the constructor of {@link ZipReader}, and `{@link ZipDirectory}#import*`.
|
|
1374
1563
|
*/
|
|
@@ -2420,7 +2609,35 @@ export interface EntryMetaData {
|
|
|
2420
2609
|
* {@link EntryMetaData#uid} and {@link EntryMetaData#gid}, which are read from the central directory.
|
|
2421
2610
|
*/
|
|
2422
2611
|
localDirectory?: LocalDirectory;
|
|
2612
|
+
/**
|
|
2613
|
+
* The non-fatal diagnostics deposited while reading the entry data, replaced every time the data is read.
|
|
2614
|
+
*
|
|
2615
|
+
* @remarks
|
|
2616
|
+
* The reasons deposited here relate to the local file header: {@link WARNING_MALFORMED_EXTRA_FIELD} when its
|
|
2617
|
+
* extra field data cannot be fully parsed, and — only when {@link ZipReaderOptions#checkLocalDirectory} is
|
|
2618
|
+
* disabled, e.g. with `strictness: "tolerant"` — the local file header mismatches the enabled check rejects
|
|
2619
|
+
* with {@link ERR_AMBIGUOUS_ARCHIVE}: {@link WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG},
|
|
2620
|
+
* {@link WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD} and
|
|
2621
|
+
* {@link WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES}. The archive-level warnings are deposited on
|
|
2622
|
+
* {@link ZipReader#warnings} instead.
|
|
2623
|
+
*/
|
|
2624
|
+
warnings?: ArchiveWarning[];
|
|
2625
|
+
}
|
|
2626
|
+
|
|
2627
|
+
/**
|
|
2628
|
+
* Represents a non-fatal diagnostic deposited on {@link ZipReader#warnings} or {@link EntryMetaData#warnings}.
|
|
2629
|
+
*/
|
|
2630
|
+
export interface ArchiveWarning {
|
|
2631
|
+
/**
|
|
2632
|
+
* The reason of the warning, one of the exported `WARNING_*` constants.
|
|
2633
|
+
*/
|
|
2634
|
+
reason: string;
|
|
2635
|
+
/**
|
|
2636
|
+
* The filename of the first entry the warning applies to, when it applies to an entry.
|
|
2637
|
+
*/
|
|
2638
|
+
filename?: string;
|
|
2423
2639
|
}
|
|
2640
|
+
|
|
2424
2641
|
export interface DirectoryEntry extends EntryMetaData {
|
|
2425
2642
|
/**
|
|
2426
2643
|
* `true` if the entry is a directory.
|
|
@@ -2693,7 +2910,8 @@ export class ZipWriter<Type> {
|
|
|
2693
2910
|
* @param filename The filename of the entry. Paths must use forward slashes ("/") as separator,
|
|
2694
2911
|
* as required by section 4.4.17.1 of the zip specification. The value is stored as-is; in
|
|
2695
2912
|
* particular, Windows path separators ("\\") are not converted and become part of the filename,
|
|
2696
|
-
* which is interpreted inconsistently by zip tools
|
|
2913
|
+
* which is interpreted inconsistently by zip tools, and leading or trailing whitespace is
|
|
2914
|
+
* preserved, which Windows filesystems cannot represent at the end of a name.
|
|
2697
2915
|
* @param reader The {@link Reader} instance used to read the content of the entry.
|
|
2698
2916
|
* @param options The options.
|
|
2699
2917
|
* @returns A promise resolving to an {@link EntryMetaData} instance.
|
|
@@ -2779,6 +2997,10 @@ export interface ZipWriterAddDataOptions
|
|
|
2779
2997
|
* The extra field of the entry written only in the local file header.
|
|
2780
2998
|
*/
|
|
2781
2999
|
localExtraField?: Map<number, Uint8Array>;
|
|
3000
|
+
/**
|
|
3001
|
+
* The extra field of the entry written only in the central directory record.
|
|
3002
|
+
*/
|
|
3003
|
+
centralExtraField?: Map<number, Uint8Array>;
|
|
2782
3004
|
/**
|
|
2783
3005
|
* The uncompressed size of the entry. This option is ignored if the {@link ZipWriterConstructorOptions#passThrough} option is not set to `true`.
|
|
2784
3006
|
*/
|
|
@@ -3179,6 +3401,9 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3179
3401
|
* zip file that does not comply with the USDZ specification, or appending it when the size of the output
|
|
3180
3402
|
* is not a multiple of 64 bytes, silently produces a non-compliant file.
|
|
3181
3403
|
*
|
|
3404
|
+
* The option is only read when the {@link ZipWriter} is created; a value passed to
|
|
3405
|
+
* {@link ZipWriter#add} is ignored.
|
|
3406
|
+
*
|
|
3182
3407
|
* @defaultValue false
|
|
3183
3408
|
*/
|
|
3184
3409
|
usdz?: boolean;
|
|
@@ -3211,6 +3436,17 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3211
3436
|
encrypted?: boolean;
|
|
3212
3437
|
/**
|
|
3213
3438
|
* The offset of the first entry in the zip file.
|
|
3439
|
+
*
|
|
3440
|
+
* @remarks
|
|
3441
|
+
* When the option is undefined, the offset is the number of bytes already written into the
|
|
3442
|
+
* destination, read from its `size` property, see {@link WritableWriter#size}. A `size` property
|
|
3443
|
+
* set on a `WritableStream` instance passed directly to the {@link ZipWriter} constructor is
|
|
3444
|
+
* also read, for backward compatibility. When the option is set, the bytes between the size of
|
|
3445
|
+
* the destination and the offset are assumed to exist in the final zip file without being
|
|
3446
|
+
* written, e.g. when writing one part of a zip file assembled by the caller.
|
|
3447
|
+
*
|
|
3448
|
+
* The option is only read when the {@link ZipWriter} is created, e.g. by
|
|
3449
|
+
* {@link ZipDirectoryEntry#exportZip}; a value passed to {@link ZipWriter#add} is ignored.
|
|
3214
3450
|
*/
|
|
3215
3451
|
offset?: number;
|
|
3216
3452
|
/**
|
|
@@ -3727,6 +3963,10 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3727
3963
|
*
|
|
3728
3964
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
3729
3965
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
3966
|
+
*
|
|
3967
|
+
* The stream is buffered entirely in memory, because reading a zip file requires random access. To import
|
|
3968
|
+
* a large file without buffering it, use {@link ZipDirectoryEntry#importZip} with a seekable input, see
|
|
3969
|
+
* the {@link ZipReader} constructor remarks and the {@link Reader} examples.
|
|
3730
3970
|
*/
|
|
3731
3971
|
importReadable(
|
|
3732
3972
|
readable: ReadableStream,
|
|
@@ -3753,6 +3993,9 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3753
3993
|
* {@link ZipReader#prependedData} or its {@link ZipReader#comment} property, since the instance created
|
|
3754
3994
|
* otherwise is not exposed. Its options are used as defaults for the options passed here, and it must not
|
|
3755
3995
|
* have read its entries yet when it is created over a `ReadableStream` instance, which can only be read once.
|
|
3996
|
+
*
|
|
3997
|
+
* Like the {@link ZipReader} constructor, a `ReadableStream` input is buffered entirely in memory, see
|
|
3998
|
+
* its remarks and the {@link Reader} examples for reading large seekable resources with random access.
|
|
3756
3999
|
*/
|
|
3757
4000
|
importZip(
|
|
3758
4001
|
reader:
|
|
@@ -4560,3 +4803,76 @@ export const ERR_UNSUPPORTED_CRYPTO_API: string;
|
|
|
4560
4803
|
* disallowing workers; set `useWebWorkers` to `false` in {@link configure} to work around it)
|
|
4561
4804
|
*/
|
|
4562
4805
|
export const ERR_WORKER_STARTUP_TIMEOUT: string;
|
|
4806
|
+
/**
|
|
4807
|
+
* Warning reason: the central directory records are not ordered by entry data position (see {@link ZipReader#warnings})
|
|
4808
|
+
*/
|
|
4809
|
+
export const WARNING_UNSORTED_CENTRAL_DIRECTORY: string;
|
|
4810
|
+
/**
|
|
4811
|
+
* Warning reason: the low byte of the "version needed to extract" field of an entry exceeds the highest known
|
|
4812
|
+
* zip specification version (see {@link ZipReader#warnings})
|
|
4813
|
+
*/
|
|
4814
|
+
export const WARNING_UNKNOWN_VERSION: string;
|
|
4815
|
+
/**
|
|
4816
|
+
* Warning reason: an entry has bit 5 of the general purpose bit flag set, i.e. declares compressed patched data
|
|
4817
|
+
* (see {@link ZipReader#warnings})
|
|
4818
|
+
*/
|
|
4819
|
+
export const WARNING_COMPRESSED_PATCHED_DATA: string;
|
|
4820
|
+
/**
|
|
4821
|
+
* Warning reason: the extra field data of a record cannot be fully parsed; the raw bytes stay available in
|
|
4822
|
+
* `rawExtraField` (see {@link ZipReader#warnings} and {@link EntryMetaData#warnings})
|
|
4823
|
+
*/
|
|
4824
|
+
export const WARNING_MALFORMED_EXTRA_FIELD: string;
|
|
4825
|
+
/**
|
|
4826
|
+
* Warning reason: the Zip64 end of central directory record carries extensible data the zip file does not use
|
|
4827
|
+
* (see {@link ZipReader#warnings})
|
|
4828
|
+
*/
|
|
4829
|
+
export const WARNING_UNKNOWN_ZIP64_EXTENSIBLE_DATA: string;
|
|
4830
|
+
/**
|
|
4831
|
+
* Warning reason: the zip file contains more than 65535 entries without Zip64, recovered from the 16-bit entry
|
|
4832
|
+
* count wrapped modulo 65536 (see {@link ZipReader#warnings})
|
|
4833
|
+
*/
|
|
4834
|
+
export const WARNING_WRAPPED_ENTRIES_COUNT: string;
|
|
4835
|
+
/**
|
|
4836
|
+
* Warning reason: data is appended after the end of the zip file (see {@link ZipReader#warnings}); the reason of
|
|
4837
|
+
* {@link ERR_AMBIGUOUS_ARCHIVE} when the appended data exceeds {@link GetEntriesOptions#maxAppendedDataSize}
|
|
4838
|
+
*/
|
|
4839
|
+
export const WARNING_APPENDED_DATA: string;
|
|
4840
|
+
/**
|
|
4841
|
+
* Warning reason: data is prepended before the zip file (see {@link ZipReader#warnings}); the reason of
|
|
4842
|
+
* {@link ERR_AMBIGUOUS_ARCHIVE} under `strictness: "strict"`
|
|
4843
|
+
*/
|
|
4844
|
+
export const WARNING_PREPENDED_DATA: string;
|
|
4845
|
+
/**
|
|
4846
|
+
* Warning reason: data lies between the end of the central directory records and the end of central directory
|
|
4847
|
+
* record, either inside the declared central directory length or beyond it (see {@link ZipReader#warnings});
|
|
4848
|
+
* the reason of {@link ERR_AMBIGUOUS_ARCHIVE} under `strictness: "strict"`
|
|
4849
|
+
*/
|
|
4850
|
+
export const WARNING_TRAILING_CENTRAL_DIRECTORY_DATA: string;
|
|
4851
|
+
/**
|
|
4852
|
+
* Warning reason: several entries share the same filename (see {@link ZipReader#warnings}); the reason of
|
|
4853
|
+
* {@link ERR_AMBIGUOUS_ARCHIVE} under `strictness: "strict"`
|
|
4854
|
+
*/
|
|
4855
|
+
export const WARNING_DUPLICATE_FILENAME: string;
|
|
4856
|
+
/**
|
|
4857
|
+
* Warning reason: the end of central directory record and its Zip64 counterpart disagree on a field stored in
|
|
4858
|
+
* both (see {@link ZipReader#warnings}); the reason of {@link ERR_AMBIGUOUS_ARCHIVE} under `strictness: "strict"`
|
|
4859
|
+
*/
|
|
4860
|
+
export const WARNING_MISMATCHED_ZIP64_END_OF_CENTRAL_DIRECTORY: string;
|
|
4861
|
+
/**
|
|
4862
|
+
* Warning reason: the general purpose bit flag of the local file header contradicts the central directory
|
|
4863
|
+
* (see {@link EntryMetaData#warnings}); the reason of {@link ERR_AMBIGUOUS_ARCHIVE} when
|
|
4864
|
+
* {@link ZipReaderOptions#checkLocalDirectory} is enabled
|
|
4865
|
+
*/
|
|
4866
|
+
export const WARNING_MISMATCHED_LOCAL_FILE_HEADER_BIT_FLAG: string;
|
|
4867
|
+
/**
|
|
4868
|
+
* Warning reason: the compression method of the local file header contradicts the central directory
|
|
4869
|
+
* (see {@link EntryMetaData#warnings}); the reason of {@link ERR_AMBIGUOUS_ARCHIVE} when
|
|
4870
|
+
* {@link ZipReaderOptions#checkLocalDirectory} is enabled
|
|
4871
|
+
*/
|
|
4872
|
+
export const WARNING_MISMATCHED_LOCAL_FILE_HEADER_COMPRESSION_METHOD: string;
|
|
4873
|
+
/**
|
|
4874
|
+
* Warning reason: the crc32 or the sizes of the local file header contradict the central directory
|
|
4875
|
+
* (see {@link EntryMetaData#warnings}); the reason of {@link ERR_AMBIGUOUS_ARCHIVE} when
|
|
4876
|
+
* {@link ZipReaderOptions#checkLocalDirectory} is enabled
|
|
4877
|
+
*/
|
|
4878
|
+
export const WARNING_MISMATCHED_LOCAL_FILE_HEADER_CRC32_OR_SIZES: string;
|