@zip.js/zip.js 2.6.47 → 2.6.49
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/dist/zip-fs-full.js +2 -2
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +2 -2
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +2 -2
- package/dist/zip-full.min.js +1 -1
- package/dist/zip-no-worker-deflate.min.js +1 -1
- package/dist/zip-no-worker-inflate.min.js +1 -1
- package/dist/zip-no-worker.min.js +1 -1
- package/dist/zip.js +2 -2
- package/dist/zip.min.js +1 -1
- package/index.cjs +2 -2
- package/index.d.ts +113 -109
- package/lib/core/io.js +6 -2
- package/package.json +3 -3
- package/tests/all/test-split-zip.js +2 -1
package/index.d.ts
CHANGED
|
@@ -29,7 +29,7 @@ declare class GenericTransformStream {
|
|
|
29
29
|
export function configure(configuration: Configuration): void
|
|
30
30
|
|
|
31
31
|
/**
|
|
32
|
-
* Represents the configuration passed to
|
|
32
|
+
* Represents the configuration passed to {@link configure}.
|
|
33
33
|
*/
|
|
34
34
|
interface Configuration extends WorkerConfiguration {
|
|
35
35
|
/**
|
|
@@ -93,31 +93,31 @@ interface Configuration extends WorkerConfiguration {
|
|
|
93
93
|
/**
|
|
94
94
|
* The codec implementation used to compress data.
|
|
95
95
|
*
|
|
96
|
-
* @defaultValue
|
|
96
|
+
* @defaultValue {@link ZipDeflate}
|
|
97
97
|
*/
|
|
98
98
|
Deflate?: typeof ZipDeflate
|
|
99
99
|
/**
|
|
100
100
|
* The codec implementation used to decompress data.
|
|
101
101
|
*
|
|
102
|
-
* @defaultValue
|
|
102
|
+
* @defaultValue {@link ZipInflate}
|
|
103
103
|
*/
|
|
104
104
|
Inflate?: typeof ZipInflate
|
|
105
105
|
/**
|
|
106
106
|
* The stream implementation used to compress data when `useCompressionStream` is set to `false`.
|
|
107
107
|
*
|
|
108
|
-
* @defaultValue
|
|
108
|
+
* @defaultValue {@link CodecStream}
|
|
109
109
|
*/
|
|
110
110
|
CompressionStream?: typeof GenericTransformStream
|
|
111
111
|
/**
|
|
112
112
|
* The stream implementation used to decompress data when `useCompressionStream` is set to `false`.
|
|
113
113
|
*
|
|
114
|
-
* @defaultValue
|
|
114
|
+
* @defaultValue {@link CodecStream}
|
|
115
115
|
*/
|
|
116
116
|
DecompressionStream?: typeof GenericTransformStream
|
|
117
117
|
}
|
|
118
118
|
|
|
119
119
|
/**
|
|
120
|
-
* Represents configuration passed to
|
|
120
|
+
* Represents configuration passed to {@link configure}, the constructor of {@link ZipReader}, {@link Entry#getData}, the constructor of {@link ZipWriter}, and {@link ZipWriter#add}.
|
|
121
121
|
*/
|
|
122
122
|
interface WorkerConfiguration {
|
|
123
123
|
/**
|
|
@@ -127,7 +127,7 @@ interface WorkerConfiguration {
|
|
|
127
127
|
*/
|
|
128
128
|
useWebWorkers?: boolean
|
|
129
129
|
/**
|
|
130
|
-
* `true` to use the API `CompressionStream`/`DecompressionStream` to compress/decompress data.
|
|
130
|
+
* `true` to use the native API `CompressionStream`/`DecompressionStream` to compress/decompress data.
|
|
131
131
|
*
|
|
132
132
|
* @defaultValue true
|
|
133
133
|
*/
|
|
@@ -140,7 +140,7 @@ interface WorkerConfiguration {
|
|
|
140
140
|
* @param library The third-party codec implementations.
|
|
141
141
|
* @param constructorOptions The options passed to the third-party implementations when building instances.
|
|
142
142
|
* @param registerDataHandler The function called to handle the `data` events triggered by a third-party codec implementation.
|
|
143
|
-
* @returns An instance containing classes compatible with
|
|
143
|
+
* @returns An instance containing classes compatible with {@link ZipDeflate} and {@link ZipInflate}.
|
|
144
144
|
*/
|
|
145
145
|
export function initShimAsyncCodec(library: EventBasedZipLibrary, constructorOptions: unknown | null, registerDataHandler: registerDataHandler): ZipLibrary
|
|
146
146
|
|
|
@@ -209,13 +209,13 @@ interface ZipLibrary {
|
|
|
209
209
|
/**
|
|
210
210
|
* The class used to compress data.
|
|
211
211
|
*
|
|
212
|
-
* @defaultValue
|
|
212
|
+
* @defaultValue {@link ZipDeflate}
|
|
213
213
|
*/
|
|
214
214
|
Deflate: typeof ZipDeflate
|
|
215
215
|
/**
|
|
216
216
|
* The class used to decompress data.
|
|
217
217
|
*
|
|
218
|
-
* @defaultValue
|
|
218
|
+
* @defaultValue {@link ZipInflate}
|
|
219
219
|
*/
|
|
220
220
|
Inflate: typeof ZipInflate
|
|
221
221
|
}
|
|
@@ -268,8 +268,8 @@ export function getMimeType(fileExtension: string): string
|
|
|
268
268
|
/**
|
|
269
269
|
* Represents an instance used to read or write unknown type of data.
|
|
270
270
|
*
|
|
271
|
-
* zip.js can handle multiple types of data thanks to a generic API. This feature is based on 2 abstract constructors:
|
|
272
|
-
* The classes inheriting from
|
|
271
|
+
* zip.js can handle multiple types of data thanks to a generic API. This feature is based on 2 abstract constructors: {@link Reader} and {@link Writer}.
|
|
272
|
+
* The classes inheriting from {@link Reader} help to read data from a source of data. The classes inheriting from {@link Writer} help to write data into a destination.
|
|
273
273
|
*/
|
|
274
274
|
interface Initializable {
|
|
275
275
|
/**
|
|
@@ -289,10 +289,10 @@ interface ReadableReader {
|
|
|
289
289
|
}
|
|
290
290
|
|
|
291
291
|
/**
|
|
292
|
-
* Represents
|
|
292
|
+
* Represents an instance used to read unknown type of data.
|
|
293
293
|
*
|
|
294
294
|
* @example
|
|
295
|
-
* Here is an example of custom
|
|
295
|
+
* Here is an example of custom {@link Reader} class used to read binary strings:
|
|
296
296
|
* ```
|
|
297
297
|
* class BinaryStringReader extends Reader {
|
|
298
298
|
*
|
|
@@ -318,7 +318,7 @@ interface ReadableReader {
|
|
|
318
318
|
*/
|
|
319
319
|
export class Reader<Type> implements Initializable, ReadableReader {
|
|
320
320
|
/**
|
|
321
|
-
* Creates the
|
|
321
|
+
* Creates the {@link Reader} instance
|
|
322
322
|
*
|
|
323
323
|
* @param value The data to read.
|
|
324
324
|
*/
|
|
@@ -346,34 +346,34 @@ export class Reader<Type> implements Initializable, ReadableReader {
|
|
|
346
346
|
}
|
|
347
347
|
|
|
348
348
|
/**
|
|
349
|
-
* Represents a
|
|
349
|
+
* Represents a {@link Reader} instance used to read data provided as a `string`.
|
|
350
350
|
*/
|
|
351
351
|
export class TextReader extends Reader<string> { }
|
|
352
352
|
|
|
353
353
|
/**
|
|
354
|
-
* Represents a
|
|
354
|
+
* Represents a {@link Reader} instance used to read data provided as a `Blob` instance.
|
|
355
355
|
*/
|
|
356
356
|
export class BlobReader extends Reader<Blob> { }
|
|
357
357
|
|
|
358
358
|
/**
|
|
359
|
-
* Represents a
|
|
359
|
+
* Represents a {@link Reader} instance used to read data provided as a Data URI `string` encoded in Base64.
|
|
360
360
|
*/
|
|
361
361
|
export class Data64URIReader extends Reader<string> { }
|
|
362
362
|
|
|
363
363
|
/**
|
|
364
|
-
* Represents a
|
|
364
|
+
* Represents a {@link Reader} instance used to read data provided as a `Uint8Array` instance.
|
|
365
365
|
*/
|
|
366
366
|
export class Uint8ArrayReader extends Reader<Uint8Array> { }
|
|
367
367
|
|
|
368
368
|
/**
|
|
369
|
-
* Represents a
|
|
369
|
+
* Represents a {@link Reader} instance used to read data provided as an array of {@link ReadableReader} instances (e.g. split zip files).
|
|
370
370
|
*
|
|
371
371
|
* @deprecated Use {@link SplitDataReader} instead.
|
|
372
372
|
*/
|
|
373
373
|
export class SplitZipReader extends SplitDataReader { }
|
|
374
374
|
|
|
375
375
|
/**
|
|
376
|
-
* Represents a
|
|
376
|
+
* Represents a {@link Reader} instance used to read data provided as an array of {@link ReadableReader} instances (e.g. split zip files).
|
|
377
377
|
*/
|
|
378
378
|
export class SplitDataReader extends Reader<Reader<unknown>[] | ReadableReader[] | ReadableStream[]> { }
|
|
379
379
|
|
|
@@ -384,11 +384,11 @@ export class SplitDataReader extends Reader<Reader<unknown>[] | ReadableReader[]
|
|
|
384
384
|
interface URLString extends String { }
|
|
385
385
|
|
|
386
386
|
/**
|
|
387
|
-
* Represents a
|
|
387
|
+
* Represents a {@link Reader} instance used to fetch data from a URL.
|
|
388
388
|
*/
|
|
389
389
|
export class HttpReader extends Reader<URLString> {
|
|
390
390
|
/**
|
|
391
|
-
* Creates the
|
|
391
|
+
* Creates the {@link HttpReader} instance
|
|
392
392
|
*
|
|
393
393
|
* @param url The URL of the data.
|
|
394
394
|
* @param options The options.
|
|
@@ -397,11 +397,11 @@ export class HttpReader extends Reader<URLString> {
|
|
|
397
397
|
}
|
|
398
398
|
|
|
399
399
|
/**
|
|
400
|
-
* Represents a
|
|
400
|
+
* Represents a {@link Reader} instance used to fetch data from servers returning `Accept-Ranges` headers.
|
|
401
401
|
*/
|
|
402
402
|
export class HttpRangeReader extends HttpReader {
|
|
403
403
|
/**
|
|
404
|
-
* Creates the
|
|
404
|
+
* Creates the {@link HttpRangeReader} instance
|
|
405
405
|
*
|
|
406
406
|
* @param url The URL of the data.
|
|
407
407
|
* @param options The options.
|
|
@@ -410,7 +410,7 @@ export class HttpRangeReader extends HttpReader {
|
|
|
410
410
|
}
|
|
411
411
|
|
|
412
412
|
/**
|
|
413
|
-
* Represents the options passed to the constructor of
|
|
413
|
+
* Represents the options passed to the constructor of {@link HttpReader}.
|
|
414
414
|
*/
|
|
415
415
|
interface HttpOptions extends HttpRangeOptions {
|
|
416
416
|
/**
|
|
@@ -434,7 +434,7 @@ interface HttpOptions extends HttpRangeOptions {
|
|
|
434
434
|
}
|
|
435
435
|
|
|
436
436
|
/**
|
|
437
|
-
* Represents options passed to the constructor of
|
|
437
|
+
* Represents options passed to the constructor of {@link HttpRangeReader} and {@link HttpReader}.
|
|
438
438
|
*/
|
|
439
439
|
interface HttpRangeOptions {
|
|
440
440
|
/**
|
|
@@ -456,14 +456,18 @@ interface WritableWriter {
|
|
|
456
456
|
/**
|
|
457
457
|
* The `WritableStream` instance.
|
|
458
458
|
*/
|
|
459
|
-
writable: WritableStream
|
|
459
|
+
writable: WritableStream,
|
|
460
|
+
/**
|
|
461
|
+
* The maximum size of split data when creating a {@link ZipWriter} instance or when calling {@link Entry#getData} with a generator of {@link WritableWriter} instances.
|
|
462
|
+
*/
|
|
463
|
+
maxSize?: number
|
|
460
464
|
}
|
|
461
465
|
|
|
462
466
|
/**
|
|
463
|
-
* Represents
|
|
467
|
+
* Represents an instance used to write unknown type of data.
|
|
464
468
|
*
|
|
465
469
|
* @example
|
|
466
|
-
* Here is an example of custom
|
|
470
|
+
* Here is an example of custom {@link Writer} class used to write binary strings:
|
|
467
471
|
* ```
|
|
468
472
|
* class BinaryStringWriter extends Writer {
|
|
469
473
|
*
|
|
@@ -512,11 +516,11 @@ export class Writer<Type> implements Initializable, WritableWriter {
|
|
|
512
516
|
}
|
|
513
517
|
|
|
514
518
|
/**
|
|
515
|
-
* Represents a
|
|
519
|
+
* Represents a {@link Writer} instance used to retrieve the written data as a `string`.
|
|
516
520
|
*/
|
|
517
521
|
export class TextWriter extends Writer<string> {
|
|
518
522
|
/**
|
|
519
|
-
* Creates the
|
|
523
|
+
* Creates the {@link TextWriter} instance
|
|
520
524
|
*
|
|
521
525
|
* @param encoding The encoding of the text.
|
|
522
526
|
*/
|
|
@@ -524,7 +528,7 @@ export class TextWriter extends Writer<string> {
|
|
|
524
528
|
}
|
|
525
529
|
|
|
526
530
|
/**
|
|
527
|
-
* Represents a
|
|
531
|
+
* Represents a {@link WritableWriter} instance used to retrieve the written data as a `Blob` instance.
|
|
528
532
|
*/
|
|
529
533
|
export class BlobWriter implements Initializable, WritableWriter {
|
|
530
534
|
/**
|
|
@@ -536,7 +540,7 @@ export class BlobWriter implements Initializable, WritableWriter {
|
|
|
536
540
|
*/
|
|
537
541
|
init(): Promise<void>
|
|
538
542
|
/**
|
|
539
|
-
* Creates the
|
|
543
|
+
* Creates the {@link BlobWriter} instance
|
|
540
544
|
*
|
|
541
545
|
* @param mimeString The MIME type of the content.
|
|
542
546
|
*/
|
|
@@ -550,11 +554,11 @@ export class BlobWriter implements Initializable, WritableWriter {
|
|
|
550
554
|
}
|
|
551
555
|
|
|
552
556
|
/**
|
|
553
|
-
* Represents a
|
|
557
|
+
* Represents a {@link Writer} instance used to retrieve the written data as a Data URI `string` encoded in Base64.
|
|
554
558
|
*/
|
|
555
559
|
export class Data64URIWriter extends Writer<string> {
|
|
556
560
|
/**
|
|
557
|
-
* Creates the
|
|
561
|
+
* Creates the {@link Data64URIWriter} instance
|
|
558
562
|
*
|
|
559
563
|
* @param mimeString The MIME type of the content.
|
|
560
564
|
*/
|
|
@@ -562,14 +566,14 @@ export class Data64URIWriter extends Writer<string> {
|
|
|
562
566
|
}
|
|
563
567
|
|
|
564
568
|
/**
|
|
565
|
-
* Represents a
|
|
569
|
+
* Represents a {@link Writer} instance used to retrieve the written data from a generator of {@link WritableWriter} instances (i.e. split zip files).
|
|
566
570
|
*
|
|
567
571
|
* @deprecated Use {@link SplitDataWriter} instead.
|
|
568
572
|
*/
|
|
569
573
|
export class SplitZipWriter extends SplitDataWriter { }
|
|
570
574
|
|
|
571
575
|
/**
|
|
572
|
-
* Represents a
|
|
576
|
+
* Represents a {@link Writer} instance used to retrieve the written data from a generator of {@link WritableWriter} instances (i.e. split zip files).
|
|
573
577
|
*/
|
|
574
578
|
export class SplitDataWriter implements Initializable, WritableWriter {
|
|
575
579
|
/**
|
|
@@ -581,21 +585,21 @@ export class SplitDataWriter implements Initializable, WritableWriter {
|
|
|
581
585
|
*/
|
|
582
586
|
init(): Promise<void>
|
|
583
587
|
/**
|
|
584
|
-
* Creates the
|
|
588
|
+
* Creates the {@link SplitDataWriter} instance
|
|
585
589
|
*
|
|
586
590
|
* @param writerGenerator The MIME type of the content.
|
|
587
|
-
* @param maxSize The maximum size of the data written into
|
|
591
|
+
* @param maxSize The maximum size of the data written into {@link Writer} instances (default: 4GB).
|
|
588
592
|
*/
|
|
589
593
|
constructor(writerGenerator: AsyncGenerator<Writer<unknown> | WritableWriter | WritableStream, boolean>, maxSize?: number)
|
|
590
594
|
}
|
|
591
595
|
|
|
592
596
|
/**
|
|
593
|
-
* Represents a
|
|
597
|
+
* Represents a {@link Writer} instance used to retrieve the written data as a `Uint8Array` instance.
|
|
594
598
|
*/
|
|
595
599
|
export class Uint8ArrayWriter extends Writer<Uint8Array> { }
|
|
596
600
|
|
|
597
601
|
/**
|
|
598
|
-
* Represents
|
|
602
|
+
* Represents an instance used to read a zip file.
|
|
599
603
|
*
|
|
600
604
|
* @example
|
|
601
605
|
* Here is an example showing how to read the text data of the first entry from a zip file:
|
|
@@ -628,9 +632,9 @@ export class Uint8ArrayWriter extends Writer<Uint8Array> { }
|
|
|
628
632
|
*/
|
|
629
633
|
export class ZipReader<Type> {
|
|
630
634
|
/**
|
|
631
|
-
* Creates the
|
|
635
|
+
* Creates the instance
|
|
632
636
|
*
|
|
633
|
-
* @param reader The
|
|
637
|
+
* @param reader The {@link Reader} instance used to read data.
|
|
634
638
|
* @param options The options.
|
|
635
639
|
*/
|
|
636
640
|
constructor(reader: Reader<Type> | ReadableReader | ReadableStream | Reader<unknown>[] | ReadableReader[] | ReadableStream[], options?: ZipReaderConstructorOptions)
|
|
@@ -650,14 +654,14 @@ export class ZipReader<Type> {
|
|
|
650
654
|
* Returns all the entries in the zip file
|
|
651
655
|
*
|
|
652
656
|
* @param options The options.
|
|
653
|
-
* @returns A promise resolving to an `array` of
|
|
657
|
+
* @returns A promise resolving to an `array` of {@link Entry} instances.
|
|
654
658
|
*/
|
|
655
659
|
getEntries(options?: ZipReaderGetEntriesOptions): Promise<Entry[]>
|
|
656
660
|
/**
|
|
657
661
|
* Returns a generator used to iterate on all the entries in the zip file
|
|
658
662
|
*
|
|
659
663
|
* @param options The options.
|
|
660
|
-
* @returns An asynchrounous generator of
|
|
664
|
+
* @returns An asynchrounous generator of {@link Entry} instances.
|
|
661
665
|
*/
|
|
662
666
|
getEntriesGenerator(options?: ZipReaderGetEntriesOptions): AsyncGenerator<Entry, boolean>
|
|
663
667
|
/**
|
|
@@ -667,17 +671,17 @@ export class ZipReader<Type> {
|
|
|
667
671
|
}
|
|
668
672
|
|
|
669
673
|
/**
|
|
670
|
-
* Represents the options passed to the constructor of
|
|
674
|
+
* Represents the options passed to the constructor of {@link ZipReader}, and `{@link ZipDirectory}#import*`.
|
|
671
675
|
*/
|
|
672
676
|
interface ZipReaderConstructorOptions extends ZipReaderOptions, GetEntriesOptions, WorkerConfiguration {
|
|
673
677
|
/**
|
|
674
|
-
* `true` to extract the prepended data into
|
|
678
|
+
* `true` to extract the prepended data into {@link ZipReader#prependedData}.
|
|
675
679
|
*
|
|
676
680
|
* @defaultValue false
|
|
677
681
|
*/
|
|
678
682
|
extractPrependedData?: boolean
|
|
679
683
|
/**
|
|
680
|
-
* `true` to extract the appended data into
|
|
684
|
+
* `true` to extract the appended data into {@link ZipReader#appendedData}.
|
|
681
685
|
*
|
|
682
686
|
* @defaultValue false
|
|
683
687
|
*/
|
|
@@ -685,12 +689,12 @@ interface ZipReaderConstructorOptions extends ZipReaderOptions, GetEntriesOption
|
|
|
685
689
|
}
|
|
686
690
|
|
|
687
691
|
/**
|
|
688
|
-
* Represents the options passed to
|
|
692
|
+
* Represents the options passed to {@link ZipReader#getEntries} and {@link ZipReader#getEntriesGenerator}.
|
|
689
693
|
*/
|
|
690
694
|
interface ZipReaderGetEntriesOptions extends GetEntriesOptions, EntryOnprogressOptions { }
|
|
691
695
|
|
|
692
696
|
/**
|
|
693
|
-
* Represents options passed to the constructor of
|
|
697
|
+
* Represents options passed to the constructor of {@link ZipReader}, {@link ZipReader#getEntries} and {@link ZipReader#getEntriesGenerator}.
|
|
694
698
|
*/
|
|
695
699
|
interface GetEntriesOptions {
|
|
696
700
|
/**
|
|
@@ -704,7 +708,7 @@ interface GetEntriesOptions {
|
|
|
704
708
|
}
|
|
705
709
|
|
|
706
710
|
/**
|
|
707
|
-
* Represents options passed to the constructor of
|
|
711
|
+
* Represents options passed to the constructor of {@link ZipReader} and {@link Entry#getData}.
|
|
708
712
|
*/
|
|
709
713
|
interface ZipReaderOptions {
|
|
710
714
|
/**
|
|
@@ -722,7 +726,7 @@ interface ZipReaderOptions {
|
|
|
722
726
|
*/
|
|
723
727
|
signal?: AbortSignal
|
|
724
728
|
/**
|
|
725
|
-
* `true` to prevent closing of
|
|
729
|
+
* `true` to prevent closing of {@link Writer#writable} when calling {@link Entry#getData}.
|
|
726
730
|
*
|
|
727
731
|
* @defaultValue false
|
|
728
732
|
*/
|
|
@@ -850,7 +854,7 @@ export interface Entry {
|
|
|
850
854
|
/**
|
|
851
855
|
* Returns the content of the entry
|
|
852
856
|
*
|
|
853
|
-
* @param writer The
|
|
857
|
+
* @param writer The {@link Writer} instance used to write the content of the entry.
|
|
854
858
|
* @param options The options.
|
|
855
859
|
* @returns A promise resolving to the type to data associated to `writer`.
|
|
856
860
|
*/
|
|
@@ -858,12 +862,12 @@ export interface Entry {
|
|
|
858
862
|
}
|
|
859
863
|
|
|
860
864
|
/**
|
|
861
|
-
* Represents the options passed to
|
|
865
|
+
* Represents the options passed to {@link Entry#getData} and `{@link ZipFileEntry}.get*`.
|
|
862
866
|
*/
|
|
863
867
|
interface EntryGetDataOptions extends EntryDataOnprogressOptions, ZipReaderOptions, WorkerConfiguration { }
|
|
864
868
|
|
|
865
869
|
/**
|
|
866
|
-
* Represents
|
|
870
|
+
* Represents an instance used to create a zip file.
|
|
867
871
|
*
|
|
868
872
|
* @example
|
|
869
873
|
* Here is an example showing how to create a zip file containing a compressed text file:
|
|
@@ -884,9 +888,9 @@ interface EntryGetDataOptions extends EntryDataOnprogressOptions, ZipReaderOptio
|
|
|
884
888
|
*/
|
|
885
889
|
export class ZipWriter<Type> {
|
|
886
890
|
/**
|
|
887
|
-
* Creates the
|
|
891
|
+
* Creates the {@link ZipWriter} instance
|
|
888
892
|
*
|
|
889
|
-
* @param writer The
|
|
893
|
+
* @param writer The {@link Writer} instance where the zip content will be written.
|
|
890
894
|
* @param options The options.
|
|
891
895
|
*/
|
|
892
896
|
constructor(writer: Writer<Type> | WritableWriter | WritableStream | AsyncGenerator<Writer<unknown> | WritableWriter | WritableStream, boolean>, options?: ZipWriterConstructorOptions)
|
|
@@ -898,9 +902,9 @@ export class ZipWriter<Type> {
|
|
|
898
902
|
* Adds an entry into the zip file
|
|
899
903
|
*
|
|
900
904
|
* @param filename The filename of the entry.
|
|
901
|
-
* @param reader The
|
|
905
|
+
* @param reader The {@link Reader} instance used to read the content of the entry.
|
|
902
906
|
* @param options The options.
|
|
903
|
-
* @returns A promise resolving to an
|
|
907
|
+
* @returns A promise resolving to an {@link Entry} instance.
|
|
904
908
|
*/
|
|
905
909
|
add<ReaderType>(filename: string, reader?: Reader<ReaderType> | ReadableReader | ReadableStream | Reader<unknown>[] | ReadableReader[] | ReadableStream[], options?: ZipWriterAddDataOptions): Promise<Entry>
|
|
906
910
|
/**
|
|
@@ -914,7 +918,7 @@ export class ZipWriter<Type> {
|
|
|
914
918
|
}
|
|
915
919
|
|
|
916
920
|
/**
|
|
917
|
-
* Represents the options passed to
|
|
921
|
+
* Represents the options passed to {@link ZipWriter#add}.
|
|
918
922
|
*/
|
|
919
923
|
interface ZipWriterAddDataOptions extends ZipWriterConstructorOptions, EntryDataOnprogressOptions, WorkerConfiguration {
|
|
920
924
|
/**
|
|
@@ -934,7 +938,7 @@ interface ZipWriterAddDataOptions extends ZipWriterConstructorOptions, EntryData
|
|
|
934
938
|
}
|
|
935
939
|
|
|
936
940
|
/**
|
|
937
|
-
* Represents the options passed to
|
|
941
|
+
* Represents the options passed to {@link ZipWriter#close}.
|
|
938
942
|
*/
|
|
939
943
|
interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
940
944
|
/**
|
|
@@ -944,7 +948,7 @@ interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
|
944
948
|
*/
|
|
945
949
|
zip64?: boolean
|
|
946
950
|
/**
|
|
947
|
-
* `true` to prevent closing of
|
|
951
|
+
* `true` to prevent closing of {@link WritableWriter#writable}.
|
|
948
952
|
*
|
|
949
953
|
* @defaultValue false
|
|
950
954
|
*/
|
|
@@ -952,7 +956,7 @@ interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
|
952
956
|
}
|
|
953
957
|
|
|
954
958
|
/**
|
|
955
|
-
* Represents options passed to the constructor of
|
|
959
|
+
* Represents options passed to the constructor of {@link ZipWriter}, {@link ZipWriter#add} and `{@link ZipDirectoryEntry}#export*`.
|
|
956
960
|
*/
|
|
957
961
|
interface ZipWriterConstructorOptions {
|
|
958
962
|
/**
|
|
@@ -964,7 +968,7 @@ interface ZipWriterConstructorOptions {
|
|
|
964
968
|
*/
|
|
965
969
|
zip64?: boolean
|
|
966
970
|
/**
|
|
967
|
-
* `true` to prevent closing of
|
|
971
|
+
* `true` to prevent closing of {@link WritableWriter#writable}.
|
|
968
972
|
*
|
|
969
973
|
* @defaultValue false
|
|
970
974
|
*/
|
|
@@ -1017,7 +1021,7 @@ interface ZipWriterConstructorOptions {
|
|
|
1017
1021
|
/**
|
|
1018
1022
|
* The last access date.
|
|
1019
1023
|
*
|
|
1020
|
-
* This option is ignored if the
|
|
1024
|
+
* This option is ignored if the {@link ZipWriterConstructorOptions#extendedTimestamp} option is set to `false`.
|
|
1021
1025
|
*
|
|
1022
1026
|
* @defaultValue The current date.
|
|
1023
1027
|
*/
|
|
@@ -1025,7 +1029,7 @@ interface ZipWriterConstructorOptions {
|
|
|
1025
1029
|
/**
|
|
1026
1030
|
* The creation date.
|
|
1027
1031
|
*
|
|
1028
|
-
* This option is ignored if the
|
|
1032
|
+
* This option is ignored if the {@link ZipWriterConstructorOptions#extendedTimestamp} option is set to `false`.
|
|
1029
1033
|
*
|
|
1030
1034
|
* @defaultValue The current date.
|
|
1031
1035
|
*/
|
|
@@ -1059,7 +1063,7 @@ interface ZipWriterConstructorOptions {
|
|
|
1059
1063
|
/**
|
|
1060
1064
|
* `true` to to add a data descriptor.
|
|
1061
1065
|
*
|
|
1062
|
-
* When set to `false`, the
|
|
1066
|
+
* When set to `false`, the {@link ZipWriterConstructorOptions#bufferedWrite} option will automatically be set to `true`.
|
|
1063
1067
|
*
|
|
1064
1068
|
* @defaultValue true
|
|
1065
1069
|
*/
|
|
@@ -1071,7 +1075,7 @@ interface ZipWriterConstructorOptions {
|
|
|
1071
1075
|
*/
|
|
1072
1076
|
dataDescriptorSignature?: boolean
|
|
1073
1077
|
/**
|
|
1074
|
-
* `true` to write
|
|
1078
|
+
* `true` to write {@link Entry#externalFileAttribute} in MS-DOS format for folder entries.
|
|
1075
1079
|
*
|
|
1076
1080
|
* @defaultValue true
|
|
1077
1081
|
*/
|
|
@@ -1091,7 +1095,7 @@ interface ZipWriterConstructorOptions {
|
|
|
1091
1095
|
}
|
|
1092
1096
|
|
|
1093
1097
|
/**
|
|
1094
|
-
* Represents options passed to
|
|
1098
|
+
* Represents options passed to {@link Entry#getData}, {@link ZipWriter.add} and `{@link ZipDirectory}.export*`.
|
|
1095
1099
|
*/
|
|
1096
1100
|
interface EntryDataOnprogressOptions {
|
|
1097
1101
|
/**
|
|
@@ -1119,7 +1123,7 @@ interface EntryDataOnprogressOptions {
|
|
|
1119
1123
|
}
|
|
1120
1124
|
|
|
1121
1125
|
/**
|
|
1122
|
-
* Represents options passed to
|
|
1126
|
+
* Represents options passed to {@link ZipReader#getEntries}, {@link ZipReader#getEntriesGenerator}, and {@link ZipWriter#close}.
|
|
1123
1127
|
*/
|
|
1124
1128
|
interface EntryOnprogressOptions {
|
|
1125
1129
|
/**
|
|
@@ -1142,7 +1146,7 @@ declare class ZipEntry {
|
|
|
1142
1146
|
*/
|
|
1143
1147
|
name: string
|
|
1144
1148
|
/**
|
|
1145
|
-
* The underlying
|
|
1149
|
+
* The underlying {@link Entry} instance.
|
|
1146
1150
|
*/
|
|
1147
1151
|
data?: Entry
|
|
1148
1152
|
/**
|
|
@@ -1170,9 +1174,9 @@ declare class ZipEntry {
|
|
|
1170
1174
|
*/
|
|
1171
1175
|
getRelativeName(ancestor: ZipDirectoryEntry): string
|
|
1172
1176
|
/**
|
|
1173
|
-
* Tests if a
|
|
1177
|
+
* Tests if a {@link ZipDirectoryEntry} instance is an ancestor of the entry
|
|
1174
1178
|
*
|
|
1175
|
-
* @param ancestor The
|
|
1179
|
+
* @param ancestor The {@link ZipDirectoryEntry} instance.
|
|
1176
1180
|
*/
|
|
1177
1181
|
isDescendantOf(ancestor: ZipDirectoryEntry): boolean
|
|
1178
1182
|
}
|
|
@@ -1182,15 +1186,15 @@ declare class ZipEntry {
|
|
|
1182
1186
|
*/
|
|
1183
1187
|
export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
1184
1188
|
/**
|
|
1185
|
-
* `void` for
|
|
1189
|
+
* `void` for {@link ZipFileEntry} instances.
|
|
1186
1190
|
*/
|
|
1187
1191
|
directory: void
|
|
1188
1192
|
/**
|
|
1189
|
-
|
|
1190
|
-
|
|
1193
|
+
* The {@link Reader} instance used to read the content of the entry.
|
|
1194
|
+
*/
|
|
1191
1195
|
reader: Reader<ReaderType> | ReadableReader
|
|
1192
1196
|
/**
|
|
1193
|
-
* The
|
|
1197
|
+
* The {@link Writer} instance used to write the content of the entry.
|
|
1194
1198
|
*/
|
|
1195
1199
|
writer: Writer<WriterType> | WritableWriter
|
|
1196
1200
|
/**
|
|
@@ -1233,11 +1237,11 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1233
1237
|
*/
|
|
1234
1238
|
getWritable(writable?: WritableStream, options?: EntryGetDataOptions): Promise<WritableStream>
|
|
1235
1239
|
/**
|
|
1236
|
-
* Retrieves the content of the entry via a
|
|
1240
|
+
* Retrieves the content of the entry via a {@link Writer} instance
|
|
1237
1241
|
*
|
|
1238
|
-
* @param writer The
|
|
1242
|
+
* @param writer The {@link Writer} instance.
|
|
1239
1243
|
* @param options The options.
|
|
1240
|
-
* @returns A promise resolving to data associated to the
|
|
1244
|
+
* @returns A promise resolving to data associated to the {@link Writer} instance.
|
|
1241
1245
|
*/
|
|
1242
1246
|
getData(writer: Writer<WriterType>, options?: EntryGetDataOptions): Promise<WriterType>
|
|
1243
1247
|
/**
|
|
@@ -1277,21 +1281,21 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1277
1281
|
*/
|
|
1278
1282
|
export class ZipDirectoryEntry extends ZipEntry {
|
|
1279
1283
|
/**
|
|
1280
|
-
* `true` for
|
|
1284
|
+
* `true` for {@link ZipDirectoryEntry} instances.
|
|
1281
1285
|
*/
|
|
1282
1286
|
directory: true
|
|
1283
1287
|
/**
|
|
1284
|
-
* Gets a
|
|
1288
|
+
* Gets a {@link ZipEntry} child instance from its relative filename
|
|
1285
1289
|
*
|
|
1286
1290
|
* @param name The relative filename.
|
|
1287
|
-
* @returns A
|
|
1291
|
+
* @returns A {@link ZipFileEntry} or a {@link ZipDirectoryEntry} instance (use the {@link ZipFileEntry#directory} and {@link ZipDirectoryEntry#directory} properties to differentiate entries).
|
|
1288
1292
|
*/
|
|
1289
1293
|
getChildByName(name: string): ZipEntry | undefined
|
|
1290
1294
|
/**
|
|
1291
1295
|
* Adds a directory
|
|
1292
1296
|
*
|
|
1293
1297
|
* @param name The relative filename of the directory
|
|
1294
|
-
* @returns A
|
|
1298
|
+
* @returns A {@link ZipDirectoryEntry} instance.
|
|
1295
1299
|
*/
|
|
1296
1300
|
addDirectory(name: string): ZipDirectoryEntry
|
|
1297
1301
|
/**
|
|
@@ -1299,7 +1303,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1299
1303
|
*
|
|
1300
1304
|
* @param name The relative filename of the entry.
|
|
1301
1305
|
* @param text The text.
|
|
1302
|
-
* @returns A
|
|
1306
|
+
* @returns A {@link ZipFileEntry} instance.
|
|
1303
1307
|
*/
|
|
1304
1308
|
addText(name: string, text: string): ZipFileEntry<string, string>
|
|
1305
1309
|
/**
|
|
@@ -1307,7 +1311,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1307
1311
|
*
|
|
1308
1312
|
* @param name The relative filename of the entry.
|
|
1309
1313
|
* @param blob The `Blob` instance.
|
|
1310
|
-
* @returns A
|
|
1314
|
+
* @returns A {@link ZipFileEntry} instance.
|
|
1311
1315
|
*/
|
|
1312
1316
|
addBlob(name: string, blob: Blob): ZipFileEntry<Blob, Blob>
|
|
1313
1317
|
/**
|
|
@@ -1315,7 +1319,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1315
1319
|
*
|
|
1316
1320
|
* @param name The relative filename of the entry.
|
|
1317
1321
|
* @param dataURI The Data URI `string` encoded in Base64.
|
|
1318
|
-
* @returns A
|
|
1322
|
+
* @returns A {@link ZipFileEntry} instance.
|
|
1319
1323
|
*/
|
|
1320
1324
|
addData64URI(name: string, dataURI: string): ZipFileEntry<string, string>
|
|
1321
1325
|
/**
|
|
@@ -1323,7 +1327,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1323
1327
|
*
|
|
1324
1328
|
* @param name The relative filename of the entry.
|
|
1325
1329
|
* @param array The `Uint8Array` instance.
|
|
1326
|
-
* @returns A
|
|
1330
|
+
* @returns A {@link ZipFileEntry} instance.
|
|
1327
1331
|
*/
|
|
1328
1332
|
addUint8Array(name: string, array: Uint8Array): ZipFileEntry<Uint8Array, Uint8Array>
|
|
1329
1333
|
/**
|
|
@@ -1332,7 +1336,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1332
1336
|
* @param name The relative filename of the entry.
|
|
1333
1337
|
* @param url The URL.
|
|
1334
1338
|
* @param options The options.
|
|
1335
|
-
* @returns A
|
|
1339
|
+
* @returns A {@link ZipFileEntry} instance.
|
|
1336
1340
|
*/
|
|
1337
1341
|
addHttpContent(name: string, url: string, options?: HttpOptions): ZipFileEntry<string, void>
|
|
1338
1342
|
/**
|
|
@@ -1340,14 +1344,14 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1340
1344
|
*
|
|
1341
1345
|
* @param name The relative filename of the entry.
|
|
1342
1346
|
* @param readable The `ReadableStream` instance.
|
|
1343
|
-
* @returns A
|
|
1347
|
+
* @returns A {@link ZipFileEntry} instance.
|
|
1344
1348
|
*/
|
|
1345
1349
|
addReadable(name: string, readable: ReadableStream): ZipFileEntry<ReadableStream, void>
|
|
1346
1350
|
/**
|
|
1347
1351
|
* Adds an entry with content provided via a `FileSystemEntry` instance
|
|
1348
1352
|
*
|
|
1349
1353
|
* @param fileSystemEntry The `FileSystemEntry` instance.
|
|
1350
|
-
* @returns A promise resolving to a
|
|
1354
|
+
* @returns A promise resolving to a {@link ZipFileEntry} or a {@link ZipDirectoryEntry} instance.
|
|
1351
1355
|
*/
|
|
1352
1356
|
addFileSystemEntry(fileSystemEntry: FileSystemEntry): Promise<ZipEntry>
|
|
1353
1357
|
/**
|
|
@@ -1417,12 +1421,12 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1417
1421
|
}
|
|
1418
1422
|
|
|
1419
1423
|
/**
|
|
1420
|
-
* Represents the options passed to
|
|
1424
|
+
* Represents the options passed to {@link ZipDirectoryEntry#importHttpContent}.
|
|
1421
1425
|
*/
|
|
1422
1426
|
interface ZipDirectoryEntryImportHttpOptions extends ZipReaderConstructorOptions, HttpOptions { }
|
|
1423
1427
|
|
|
1424
1428
|
/**
|
|
1425
|
-
* Represents the options passed to `ZipDirectoryEntry#export*()`.
|
|
1429
|
+
* Represents the options passed to `{@link ZipDirectoryEntry}#export*()`.
|
|
1426
1430
|
*/
|
|
1427
1431
|
interface ZipDirectoryEntryExportOptions extends ZipWriterConstructorOptions, EntryDataOnprogressOptions {
|
|
1428
1432
|
/**
|
|
@@ -1455,30 +1459,30 @@ export class FS extends ZipDirectoryEntry {
|
|
|
1455
1459
|
*/
|
|
1456
1460
|
root: ZipDirectoryEntry
|
|
1457
1461
|
/**
|
|
1458
|
-
* Removes a
|
|
1462
|
+
* Removes a {@link ZipEntry} instance and its children
|
|
1459
1463
|
*
|
|
1460
|
-
* @param entry The
|
|
1464
|
+
* @param entry The {@link ZipEntry} instance to remove.
|
|
1461
1465
|
*/
|
|
1462
1466
|
remove(entry: ZipEntry): void
|
|
1463
1467
|
/**
|
|
1464
|
-
* Moves a
|
|
1468
|
+
* Moves a {@link ZipEntry} instance and its children into a {@link ZipDirectoryEntry} instance
|
|
1465
1469
|
*
|
|
1466
|
-
* @param entry The
|
|
1467
|
-
* @param destination The
|
|
1470
|
+
* @param entry The {@link ZipEntry} instance to move.
|
|
1471
|
+
* @param destination The {@link ZipDirectoryEntry} instance.
|
|
1468
1472
|
*/
|
|
1469
1473
|
move(entry: ZipEntry, destination: ZipDirectoryEntry): void
|
|
1470
1474
|
/**
|
|
1471
|
-
* Returns a
|
|
1475
|
+
* Returns a {@link ZipEntry} instance from its full filename
|
|
1472
1476
|
*
|
|
1473
1477
|
* @param fullname The full filename.
|
|
1474
|
-
* @returns The
|
|
1478
|
+
* @returns The {@link ZipEntry} instance.
|
|
1475
1479
|
*/
|
|
1476
1480
|
find(fullname: string): ZipEntry | undefined
|
|
1477
1481
|
/**
|
|
1478
|
-
* Returns a
|
|
1482
|
+
* Returns a {@link ZipEntry} instance from the value of {@link ZipEntry#id}
|
|
1479
1483
|
*
|
|
1480
|
-
* @param id The id of the
|
|
1481
|
-
* @returns The
|
|
1484
|
+
* @param id The id of the {@link ZipEntry} instance.
|
|
1485
|
+
* @returns The {@link ZipEntry} instance.
|
|
1482
1486
|
*/
|
|
1483
1487
|
getById(id: number): ZipEntry | undefined
|
|
1484
1488
|
}
|
|
@@ -1490,19 +1494,19 @@ export const fs: {
|
|
|
1490
1494
|
/**
|
|
1491
1495
|
* The Filesystem constructor.
|
|
1492
1496
|
*
|
|
1493
|
-
* @defaultValue
|
|
1497
|
+
* @defaultValue {@link FS}
|
|
1494
1498
|
*/
|
|
1495
1499
|
FS: typeof FS
|
|
1496
1500
|
/**
|
|
1497
|
-
* The
|
|
1501
|
+
* The {@link ZipDirectoryEntry} constructor.
|
|
1498
1502
|
*
|
|
1499
|
-
* @defaultValue
|
|
1503
|
+
* @defaultValue {@link ZipDirectoryEntry}
|
|
1500
1504
|
*/
|
|
1501
1505
|
ZipDirectoryEntry: typeof ZipDirectoryEntry
|
|
1502
1506
|
/**
|
|
1503
|
-
* The
|
|
1507
|
+
* The {@link ZipFileEntry} constructor.
|
|
1504
1508
|
*
|
|
1505
|
-
* @defaultValue
|
|
1509
|
+
* @defaultValue {@link ZipFileEntry}
|
|
1506
1510
|
*/
|
|
1507
1511
|
ZipFileEntry: typeof ZipFileEntry
|
|
1508
1512
|
}
|