@zip.js/zip.js 2.7.35 → 2.7.37
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 +5 -0
- package/dist/zip-fs-full.js +6 -4
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +6 -4
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +6 -4
- 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 +6 -4
- package/dist/zip.min.js +1 -1
- package/index.cjs +6 -4
- package/index.d.ts +102 -99
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +6 -4
- package/package.json +1 -1
package/index.d.ts
CHANGED
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
/**
|
|
2
|
-
*
|
|
2
|
+
* Represents the `FileSystemEntry` class.
|
|
3
|
+
*
|
|
4
|
+
* @see {@link https://wicg.github.io/entries-api/#api-entry|specification}
|
|
3
5
|
*/
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
*
|
|
15
|
-
* @see {@link https://fs.spec.whatwg.org/#api-filesystemhandle}
|
|
16
|
-
*/
|
|
17
|
-
// deno-lint-ignore no-empty-interface
|
|
18
|
-
interface FileSystemHandle {}
|
|
19
|
-
}
|
|
6
|
+
// deno-lint-ignore no-empty-interface
|
|
7
|
+
interface FileSystemEntry {}
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* Represents the `FileSystemHandle` class.
|
|
11
|
+
*
|
|
12
|
+
* @see {@link https://fs.spec.whatwg.org/#api-filesystemhandle}
|
|
13
|
+
*/
|
|
14
|
+
// deno-lint-ignore no-empty-interface
|
|
15
|
+
interface FileSystemHandle {}
|
|
20
16
|
|
|
21
17
|
/**
|
|
22
18
|
* Represents a generic `TransformStream` class.
|
|
@@ -38,7 +34,7 @@ export function configure(configuration: Configuration): void;
|
|
|
38
34
|
/**
|
|
39
35
|
* Represents the configuration passed to {@link configure}.
|
|
40
36
|
*/
|
|
41
|
-
interface Configuration extends WorkerConfiguration {
|
|
37
|
+
export interface Configuration extends WorkerConfiguration {
|
|
42
38
|
/**
|
|
43
39
|
* The maximum number of web workers used to compress/decompress data simultaneously.
|
|
44
40
|
*
|
|
@@ -126,7 +122,7 @@ interface Configuration extends WorkerConfiguration {
|
|
|
126
122
|
/**
|
|
127
123
|
* Represents configuration passed to {@link configure}, the constructor of {@link ZipReader}, {@link Entry#getData}, the constructor of {@link ZipWriter}, and {@link ZipWriter#add}.
|
|
128
124
|
*/
|
|
129
|
-
interface WorkerConfiguration {
|
|
125
|
+
export interface WorkerConfiguration {
|
|
130
126
|
/**
|
|
131
127
|
* `true` to use web workers to compress/decompress data in non-blocking background processes.
|
|
132
128
|
*
|
|
@@ -158,7 +154,7 @@ export function initShimAsyncCodec(
|
|
|
158
154
|
/**
|
|
159
155
|
* Represents the callback function used to register the `data` event handler.
|
|
160
156
|
*/
|
|
161
|
-
interface registerDataHandler {
|
|
157
|
+
export interface registerDataHandler {
|
|
162
158
|
/**
|
|
163
159
|
* @param codec The third-party codec instance.
|
|
164
160
|
* @param onData The `data` event handler.
|
|
@@ -169,7 +165,7 @@ interface registerDataHandler {
|
|
|
169
165
|
/**
|
|
170
166
|
* Represents the callback function used to handle `data` events.
|
|
171
167
|
*/
|
|
172
|
-
interface dataHandler {
|
|
168
|
+
export interface dataHandler {
|
|
173
169
|
/**
|
|
174
170
|
* @param data The processed chunk of data.
|
|
175
171
|
*/
|
|
@@ -184,7 +180,7 @@ export function terminateWorkers(): Promise<void>;
|
|
|
184
180
|
/**
|
|
185
181
|
* Represents event-based implementations used to compress/decompress data.
|
|
186
182
|
*/
|
|
187
|
-
interface EventBasedZipLibrary {
|
|
183
|
+
export interface EventBasedZipLibrary {
|
|
188
184
|
/**
|
|
189
185
|
* The class used to compress data.
|
|
190
186
|
*/
|
|
@@ -216,7 +212,7 @@ declare class EventBasedCodec {
|
|
|
216
212
|
/**
|
|
217
213
|
* Represents the implementations zip.js uses to compress/decompress data.
|
|
218
214
|
*/
|
|
219
|
-
interface ZipLibrary {
|
|
215
|
+
export interface ZipLibrary {
|
|
220
216
|
/**
|
|
221
217
|
* The class used to compress data.
|
|
222
218
|
*
|
|
@@ -282,7 +278,7 @@ export function getMimeType(fileExtension: string): string;
|
|
|
282
278
|
* 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}.
|
|
283
279
|
* 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.
|
|
284
280
|
*/
|
|
285
|
-
interface Initializable {
|
|
281
|
+
export interface Initializable {
|
|
286
282
|
/**
|
|
287
283
|
* Initializes the instance asynchronously
|
|
288
284
|
*/
|
|
@@ -292,7 +288,7 @@ interface Initializable {
|
|
|
292
288
|
/**
|
|
293
289
|
* Represents an instance used to read data from a `ReadableStream` instance.
|
|
294
290
|
*/
|
|
295
|
-
interface ReadableReader {
|
|
291
|
+
export interface ReadableReader {
|
|
296
292
|
/**
|
|
297
293
|
* The `ReadableStream` instance.
|
|
298
294
|
*/
|
|
@@ -424,7 +420,7 @@ export class HttpRangeReader extends HttpReader {
|
|
|
424
420
|
/**
|
|
425
421
|
* Represents the options passed to the constructor of {@link HttpReader}.
|
|
426
422
|
*/
|
|
427
|
-
interface HttpOptions extends HttpRangeOptions {
|
|
423
|
+
export interface HttpOptions extends HttpRangeOptions {
|
|
428
424
|
/**
|
|
429
425
|
* `true` to use `Range` headers when fetching data from servers returning `Accept-Ranges` headers.
|
|
430
426
|
*
|
|
@@ -448,7 +444,7 @@ interface HttpOptions extends HttpRangeOptions {
|
|
|
448
444
|
/**
|
|
449
445
|
* Represents options passed to the constructor of {@link HttpRangeReader} and {@link HttpReader}.
|
|
450
446
|
*/
|
|
451
|
-
interface HttpRangeOptions {
|
|
447
|
+
export interface HttpRangeOptions {
|
|
452
448
|
/**
|
|
453
449
|
* `true` to rely `XMLHttpRequest` instead of `fetch` to fetch data.
|
|
454
450
|
*
|
|
@@ -464,7 +460,7 @@ interface HttpRangeOptions {
|
|
|
464
460
|
/**
|
|
465
461
|
* Represents an instance used to write data into a `WritableStream` instance.
|
|
466
462
|
*/
|
|
467
|
-
interface WritableWriter {
|
|
463
|
+
export interface WritableWriter {
|
|
468
464
|
/**
|
|
469
465
|
* The `WritableStream` instance.
|
|
470
466
|
*/
|
|
@@ -632,22 +628,24 @@ export class Uint8ArrayWriter extends Writer<Uint8Array> {}
|
|
|
632
628
|
* ```
|
|
633
629
|
*/
|
|
634
630
|
export class ZipReaderStream<T> {
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
631
|
+
/**
|
|
632
|
+
* Creates the stream.
|
|
633
|
+
*
|
|
634
|
+
* @param options The options.
|
|
635
|
+
*/
|
|
636
|
+
constructor(options?: ZipReaderConstructorOptions);
|
|
637
|
+
|
|
638
|
+
/**
|
|
639
|
+
* The readable stream.
|
|
640
|
+
*/
|
|
641
|
+
readable: ReadableStream<
|
|
642
|
+
Omit<Entry, "getData"> & { readable?: ReadableStream<Uint8Array> }
|
|
643
|
+
>;
|
|
644
|
+
|
|
645
|
+
/**
|
|
646
|
+
* The writable stream.
|
|
647
|
+
*/
|
|
648
|
+
writable: WritableStream<T>;
|
|
651
649
|
}
|
|
652
650
|
|
|
653
651
|
/**
|
|
@@ -736,7 +734,7 @@ export class ZipReader<Type> {
|
|
|
736
734
|
/**
|
|
737
735
|
* Represents the options passed to the constructor of {@link ZipReader}, and `{@link ZipDirectory}#import*`.
|
|
738
736
|
*/
|
|
739
|
-
interface ZipReaderConstructorOptions
|
|
737
|
+
export interface ZipReaderConstructorOptions
|
|
740
738
|
extends ZipReaderOptions, GetEntriesOptions, WorkerConfiguration {
|
|
741
739
|
/**
|
|
742
740
|
* `true` to extract the prepended data into {@link ZipReader#prependedData}.
|
|
@@ -755,13 +753,13 @@ interface ZipReaderConstructorOptions
|
|
|
755
753
|
/**
|
|
756
754
|
* Represents the options passed to {@link ZipReader#getEntries} and {@link ZipReader#getEntriesGenerator}.
|
|
757
755
|
*/
|
|
758
|
-
interface ZipReaderGetEntriesOptions
|
|
756
|
+
export interface ZipReaderGetEntriesOptions
|
|
759
757
|
extends GetEntriesOptions, EntryOnprogressOptions {}
|
|
760
758
|
|
|
761
759
|
/**
|
|
762
760
|
* Represents options passed to the constructor of {@link ZipReader}, {@link ZipReader#getEntries} and {@link ZipReader#getEntriesGenerator}.
|
|
763
761
|
*/
|
|
764
|
-
interface GetEntriesOptions {
|
|
762
|
+
export interface GetEntriesOptions {
|
|
765
763
|
/**
|
|
766
764
|
* The encoding of the filename of the entry.
|
|
767
765
|
*/
|
|
@@ -775,7 +773,7 @@ interface GetEntriesOptions {
|
|
|
775
773
|
/**
|
|
776
774
|
* Represents options passed to the constructor of {@link ZipReader} and {@link Entry#getData}.
|
|
777
775
|
*/
|
|
778
|
-
interface ZipReaderCheckPasswordOptions {
|
|
776
|
+
export interface ZipReaderCheckPasswordOptions {
|
|
779
777
|
/**
|
|
780
778
|
* `true` to check only if the password is valid.
|
|
781
779
|
*
|
|
@@ -787,7 +785,7 @@ interface ZipReaderCheckPasswordOptions {
|
|
|
787
785
|
/**
|
|
788
786
|
* Represents options passed to the constructor of {@link ZipReader} and {@link Entry#getData}.
|
|
789
787
|
*/
|
|
790
|
-
interface ZipReaderOptions {
|
|
788
|
+
export interface ZipReaderOptions {
|
|
791
789
|
/**
|
|
792
790
|
* `true` to check the signature of the entry.
|
|
793
791
|
*
|
|
@@ -972,13 +970,13 @@ export interface Entry extends EntryMetaData {
|
|
|
972
970
|
/**
|
|
973
971
|
* Represents the options passed to {@link Entry#getData} and `{@link ZipFileEntry}.get*`.
|
|
974
972
|
*/
|
|
975
|
-
interface EntryGetDataOptions
|
|
973
|
+
export interface EntryGetDataOptions
|
|
976
974
|
extends EntryDataOnprogressOptions, ZipReaderOptions, WorkerConfiguration {}
|
|
977
975
|
|
|
978
976
|
/**
|
|
979
977
|
* Represents the options passed to {@link Entry#getData} and `{@link ZipFileEntry}.get*`.
|
|
980
978
|
*/
|
|
981
|
-
interface EntryGetDataCheckPasswordOptions
|
|
979
|
+
export interface EntryGetDataCheckPasswordOptions
|
|
982
980
|
extends EntryGetDataOptions, ZipReaderCheckPasswordOptions {}
|
|
983
981
|
|
|
984
982
|
/**
|
|
@@ -1018,47 +1016,52 @@ interface EntryGetDataCheckPasswordOptions
|
|
|
1018
1016
|
* ```
|
|
1019
1017
|
*/
|
|
1020
1018
|
export class ZipWriterStream {
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1019
|
+
/**
|
|
1020
|
+
* Creates the stream.
|
|
1021
|
+
*
|
|
1022
|
+
* @param options The options.
|
|
1023
|
+
*/
|
|
1024
|
+
constructor(options?: ZipWriterConstructorOptions);
|
|
1025
|
+
|
|
1026
|
+
/**
|
|
1027
|
+
* The readable stream.
|
|
1028
|
+
*/
|
|
1029
|
+
readable: ReadableStream<Uint8Array>;
|
|
1030
|
+
|
|
1031
|
+
/**
|
|
1032
|
+
* The ZipWriter property.
|
|
1033
|
+
*/
|
|
1034
|
+
zipWriter: ZipWriter<unknown>;
|
|
1035
|
+
|
|
1036
|
+
/**
|
|
1037
|
+
* Returns an object containing a readable and writable property for the .pipeThrough method
|
|
1038
|
+
*
|
|
1039
|
+
* @param path The name of the stream when unzipped.
|
|
1040
|
+
* @returns An object containing readable and writable properties
|
|
1041
|
+
*/
|
|
1042
|
+
transform<T>(
|
|
1043
|
+
path: string,
|
|
1044
|
+
): { readable: ReadableStream<T>; writable: WritableStream<T> };
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* Returns a WritableStream for the .pipeTo method
|
|
1048
|
+
*
|
|
1049
|
+
* @param path The directory path of where the stream should exist in the zipped stream.
|
|
1050
|
+
* @returns A WritableStream.
|
|
1051
|
+
*/
|
|
1052
|
+
writable<T>(path: string): WritableStream<T>;
|
|
1053
|
+
|
|
1054
|
+
/**
|
|
1055
|
+
* Writes the entries directory, writes the global comment, and returns the content of the zipped file.
|
|
1056
|
+
*
|
|
1057
|
+
* @param comment The global comment of the zip file.
|
|
1058
|
+
* @param options The options.
|
|
1059
|
+
* @returns The content of the zip file.
|
|
1060
|
+
*/
|
|
1061
|
+
close(
|
|
1062
|
+
comment?: Uint8Array,
|
|
1063
|
+
options?: ZipWriterCloseOptions,
|
|
1064
|
+
): Promise<unknown>;
|
|
1062
1065
|
}
|
|
1063
1066
|
|
|
1064
1067
|
/**
|
|
@@ -1135,7 +1138,7 @@ export class ZipWriter<Type> {
|
|
|
1135
1138
|
/**
|
|
1136
1139
|
* Represents the options passed to {@link ZipWriter#add}.
|
|
1137
1140
|
*/
|
|
1138
|
-
interface ZipWriterAddDataOptions
|
|
1141
|
+
export interface ZipWriterAddDataOptions
|
|
1139
1142
|
extends
|
|
1140
1143
|
ZipWriterConstructorOptions,
|
|
1141
1144
|
EntryDataOnprogressOptions,
|
|
@@ -1159,7 +1162,7 @@ interface ZipWriterAddDataOptions
|
|
|
1159
1162
|
/**
|
|
1160
1163
|
* Represents the options passed to {@link ZipWriter#close}.
|
|
1161
1164
|
*/
|
|
1162
|
-
interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
1165
|
+
export interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
1163
1166
|
/**
|
|
1164
1167
|
* `true` to use Zip64 to write the entries directory.
|
|
1165
1168
|
*
|
|
@@ -1177,7 +1180,7 @@ interface ZipWriterCloseOptions extends EntryOnprogressOptions {
|
|
|
1177
1180
|
/**
|
|
1178
1181
|
* Represents options passed to the constructor of {@link ZipWriter}, {@link ZipWriter#add} and `{@link ZipDirectoryEntry}#export*`.
|
|
1179
1182
|
*/
|
|
1180
|
-
interface ZipWriterConstructorOptions {
|
|
1183
|
+
export interface ZipWriterConstructorOptions {
|
|
1181
1184
|
/**
|
|
1182
1185
|
* `true` to use Zip64 to store the entry.
|
|
1183
1186
|
*
|
|
@@ -1332,7 +1335,7 @@ interface ZipWriterConstructorOptions {
|
|
|
1332
1335
|
/**
|
|
1333
1336
|
* Represents options passed to {@link Entry#getData}, {@link ZipWriter.add} and `{@link ZipDirectory}.export*`.
|
|
1334
1337
|
*/
|
|
1335
|
-
interface EntryDataOnprogressOptions {
|
|
1338
|
+
export interface EntryDataOnprogressOptions {
|
|
1336
1339
|
/**
|
|
1337
1340
|
* The function called when starting compression/decompression.
|
|
1338
1341
|
*
|
|
@@ -1360,7 +1363,7 @@ interface EntryDataOnprogressOptions {
|
|
|
1360
1363
|
/**
|
|
1361
1364
|
* Represents options passed to {@link ZipReader#getEntries}, {@link ZipReader#getEntriesGenerator}, and {@link ZipWriter#close}.
|
|
1362
1365
|
*/
|
|
1363
|
-
interface EntryOnprogressOptions {
|
|
1366
|
+
export interface EntryOnprogressOptions {
|
|
1364
1367
|
/**
|
|
1365
1368
|
* The function called each time an entry is read/written.
|
|
1366
1369
|
*
|
|
@@ -1818,13 +1821,13 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1818
1821
|
/**
|
|
1819
1822
|
* Represents the options passed to {@link ZipDirectoryEntry#importHttpContent}.
|
|
1820
1823
|
*/
|
|
1821
|
-
interface ZipDirectoryEntryImportHttpOptions
|
|
1824
|
+
export interface ZipDirectoryEntryImportHttpOptions
|
|
1822
1825
|
extends ZipReaderConstructorOptions, HttpOptions {}
|
|
1823
1826
|
|
|
1824
1827
|
/**
|
|
1825
1828
|
* Represents the options passed to `{@link ZipDirectoryEntry}#export*()`.
|
|
1826
1829
|
*/
|
|
1827
|
-
interface ZipDirectoryEntryExportOptions
|
|
1830
|
+
export interface ZipDirectoryEntryExportOptions
|
|
1828
1831
|
extends ZipWriterConstructorOptions, EntryDataOnprogressOptions {
|
|
1829
1832
|
/**
|
|
1830
1833
|
* `true` to use filenames relative to the entry instead of full filenames.
|