@zip.js/zip.js 2.8.59 → 2.8.61
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 +167 -37
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +143 -20
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +173 -45
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +5326 -3928
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +173 -45
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +151 -30
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +176 -45
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +145 -22
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-native.js +145 -22
- 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 +170 -37
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +151 -30
- package/index-native.min.js +1 -1
- package/index.cjs +176 -45
- package/index.d.cts +134 -1
- package/index.d.ts +134 -1
- 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/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-fs.js +5 -4
- package/lib/core/zip-writer.js +38 -31
- package/lib/zip-core-base.js +7 -0
- package/lib/zip-fs-core.js +32 -0
- package/package.json +4 -3
- package/release.sh +47 -0
- 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.
|
|
@@ -3289,6 +3401,9 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3289
3401
|
* zip file that does not comply with the USDZ specification, or appending it when the size of the output
|
|
3290
3402
|
* is not a multiple of 64 bytes, silently produces a non-compliant file.
|
|
3291
3403
|
*
|
|
3404
|
+
* The option is only read when the {@link ZipWriter} is created; a value passed to
|
|
3405
|
+
* {@link ZipWriter#add} is ignored.
|
|
3406
|
+
*
|
|
3292
3407
|
* @defaultValue false
|
|
3293
3408
|
*/
|
|
3294
3409
|
usdz?: boolean;
|
|
@@ -3321,6 +3436,17 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3321
3436
|
encrypted?: boolean;
|
|
3322
3437
|
/**
|
|
3323
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.
|
|
3324
3450
|
*/
|
|
3325
3451
|
offset?: number;
|
|
3326
3452
|
/**
|
|
@@ -3837,6 +3963,10 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3837
3963
|
*
|
|
3838
3964
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
3839
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.
|
|
3840
3970
|
*/
|
|
3841
3971
|
importReadable(
|
|
3842
3972
|
readable: ReadableStream,
|
|
@@ -3863,6 +3993,9 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3863
3993
|
* {@link ZipReader#prependedData} or its {@link ZipReader#comment} property, since the instance created
|
|
3864
3994
|
* otherwise is not exposed. Its options are used as defaults for the options passed here, and it must not
|
|
3865
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.
|
|
3866
3999
|
*/
|
|
3867
4000
|
importZip(
|
|
3868
4001
|
reader:
|
package/index.d.ts
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.
|
|
@@ -3289,6 +3401,9 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3289
3401
|
* zip file that does not comply with the USDZ specification, or appending it when the size of the output
|
|
3290
3402
|
* is not a multiple of 64 bytes, silently produces a non-compliant file.
|
|
3291
3403
|
*
|
|
3404
|
+
* The option is only read when the {@link ZipWriter} is created; a value passed to
|
|
3405
|
+
* {@link ZipWriter#add} is ignored.
|
|
3406
|
+
*
|
|
3292
3407
|
* @defaultValue false
|
|
3293
3408
|
*/
|
|
3294
3409
|
usdz?: boolean;
|
|
@@ -3321,6 +3436,17 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3321
3436
|
encrypted?: boolean;
|
|
3322
3437
|
/**
|
|
3323
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.
|
|
3324
3450
|
*/
|
|
3325
3451
|
offset?: number;
|
|
3326
3452
|
/**
|
|
@@ -3837,6 +3963,10 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3837
3963
|
*
|
|
3838
3964
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
3839
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.
|
|
3840
3970
|
*/
|
|
3841
3971
|
importReadable(
|
|
3842
3972
|
readable: ReadableStream,
|
|
@@ -3863,6 +3993,9 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
3863
3993
|
* {@link ZipReader#prependedData} or its {@link ZipReader#comment} property, since the instance created
|
|
3864
3994
|
* otherwise is not exposed. Its options are used as defaults for the options passed here, and it must not
|
|
3865
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.
|
|
3866
3999
|
*/
|
|
3867
4000
|
importZip(
|
|
3868
4001
|
reader:
|