@zip.js/zip.js 2.7.63 → 2.7.65
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/deno.json +1 -1
- package/dist/z-worker-fflate.js +1 -1
- package/dist/z-worker-pako.js +1 -1
- package/dist/z-worker.js +1 -1
- package/dist/zip-fs-full.js +577 -282
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +579 -284
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +570 -278
- 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 +570 -278
- package/dist/zip.min.js +1 -1
- package/index-fflate.js +2 -1
- package/index.cjs +577 -282
- package/index.d.ts +133 -80
- package/index.js +1 -0
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +11 -6
- package/lib/core/constants.js +22 -7
- package/lib/core/io.js +71 -51
- package/lib/core/streams/codec-stream.js +2 -3
- package/lib/core/z-worker-core.js +4 -2
- package/lib/core/zip-fs-core.js +9 -6
- package/lib/core/zip-reader.js +28 -14
- package/lib/core/zip-writer.js +463 -203
- package/lib/z-worker-inline.js +1 -1
- package/package.json +3 -3
package/index.d.ts
CHANGED
|
@@ -156,7 +156,7 @@
|
|
|
156
156
|
* ```
|
|
157
157
|
*
|
|
158
158
|
* @module
|
|
159
|
-
*/
|
|
159
|
+
*/
|
|
160
160
|
|
|
161
161
|
/**
|
|
162
162
|
* Represents the `FileSystemEntry` class.
|
|
@@ -164,7 +164,7 @@
|
|
|
164
164
|
* @see {@link https://wicg.github.io/entries-api/#api-entry|specification}
|
|
165
165
|
*/
|
|
166
166
|
// deno-lint-ignore no-empty-interface
|
|
167
|
-
interface FileSystemEntryLike {
|
|
167
|
+
interface FileSystemEntryLike {}
|
|
168
168
|
|
|
169
169
|
/**
|
|
170
170
|
* Represents the `FileSystemHandle` class.
|
|
@@ -172,7 +172,7 @@ interface FileSystemEntryLike { }
|
|
|
172
172
|
* @see {@link https://fs.spec.whatwg.org/#api-filesystemhandle}
|
|
173
173
|
*/
|
|
174
174
|
// deno-lint-ignore no-empty-interface
|
|
175
|
-
interface FileSystemHandleLike {
|
|
175
|
+
interface FileSystemHandleLike {}
|
|
176
176
|
|
|
177
177
|
/**
|
|
178
178
|
* Represents a generic `TransformStream` class.
|
|
@@ -314,7 +314,7 @@ export interface WorkerConfiguration {
|
|
|
314
314
|
export function initShimAsyncCodec(
|
|
315
315
|
library: EventBasedZipLibrary,
|
|
316
316
|
constructorOptions: unknown | null,
|
|
317
|
-
registerDataHandler: registerDataHandler
|
|
317
|
+
registerDataHandler: registerDataHandler
|
|
318
318
|
): ZipLibrary;
|
|
319
319
|
|
|
320
320
|
/**
|
|
@@ -428,7 +428,7 @@ declare class ZipInflate extends SyncCodec {
|
|
|
428
428
|
/**
|
|
429
429
|
* Represents a class implementing `CompressionStream` or `DecompressionStream` interfaces.
|
|
430
430
|
*/
|
|
431
|
-
declare class CodecStream extends TransformStream {
|
|
431
|
+
declare class CodecStream extends TransformStream {}
|
|
432
432
|
|
|
433
433
|
/**
|
|
434
434
|
* Returns the MIME type corresponding to a filename extension.
|
|
@@ -513,7 +513,7 @@ export class Reader<Type> implements Initializable, ReadableReader {
|
|
|
513
513
|
*
|
|
514
514
|
* @param index The byte index of the data to read.
|
|
515
515
|
* @param length The length of the data to read in bytes.
|
|
516
|
-
* @returns A promise resolving to a chunk of data.
|
|
516
|
+
* @returns A promise resolving to a chunk of data. The data must be trucated to the remaining size if the requested length is larger than the remaining size.
|
|
517
517
|
*/
|
|
518
518
|
readUint8Array(index: number, length: number): Promise<Uint8Array>;
|
|
519
519
|
}
|
|
@@ -521,40 +521,41 @@ export class Reader<Type> implements Initializable, ReadableReader {
|
|
|
521
521
|
/**
|
|
522
522
|
* Represents a {@link Reader} instance used to read data provided as a `string`.
|
|
523
523
|
*/
|
|
524
|
-
export class TextReader extends Reader<string> {
|
|
524
|
+
export class TextReader extends Reader<string> {}
|
|
525
525
|
|
|
526
526
|
/**
|
|
527
527
|
* Represents a {@link Reader} instance used to read data provided as a `Blob` instance.
|
|
528
528
|
*/
|
|
529
|
-
export class BlobReader extends Reader<Blob> {
|
|
529
|
+
export class BlobReader extends Reader<Blob> {}
|
|
530
530
|
|
|
531
531
|
/**
|
|
532
532
|
* Represents a {@link Reader} instance used to read data provided as a Data URI `string` encoded in Base64.
|
|
533
533
|
*/
|
|
534
|
-
export class Data64URIReader extends Reader<string> {
|
|
534
|
+
export class Data64URIReader extends Reader<string> {}
|
|
535
535
|
|
|
536
536
|
/**
|
|
537
537
|
* Represents a {@link Reader} instance used to read data provided as a `Uint8Array` instance.
|
|
538
538
|
*/
|
|
539
|
-
export class Uint8ArrayReader extends Reader<Uint8Array> {
|
|
539
|
+
export class Uint8ArrayReader extends Reader<Uint8Array> {}
|
|
540
540
|
|
|
541
541
|
/**
|
|
542
542
|
* Represents a {@link Reader} instance used to read data provided as an array of {@link ReadableReader} instances (e.g. split zip files).
|
|
543
543
|
*
|
|
544
544
|
* @deprecated Use {@link SplitDataReader} instead.
|
|
545
545
|
*/
|
|
546
|
-
export class SplitZipReader extends SplitDataReader {
|
|
546
|
+
export class SplitZipReader extends SplitDataReader {}
|
|
547
547
|
|
|
548
548
|
/**
|
|
549
549
|
* Represents a {@link Reader} instance used to read data provided as an array of {@link ReadableReader} instances (e.g. split zip files).
|
|
550
550
|
*/
|
|
551
|
-
export class SplitDataReader
|
|
552
|
-
|
|
551
|
+
export class SplitDataReader extends Reader<
|
|
552
|
+
Reader<unknown>[] | ReadableReader[] | ReadableStream[]
|
|
553
|
+
> {}
|
|
553
554
|
|
|
554
555
|
/**
|
|
555
556
|
* Represents a URL stored into a `string`.
|
|
556
557
|
*/
|
|
557
|
-
interface URLString extends String {
|
|
558
|
+
interface URLString extends String {}
|
|
558
559
|
|
|
559
560
|
/**
|
|
560
561
|
* Represents a {@link Reader} instance used to fetch data from a URL.
|
|
@@ -750,7 +751,7 @@ export class Data64URIWriter extends Writer<string> {
|
|
|
750
751
|
*
|
|
751
752
|
* @deprecated Use {@link SplitDataWriter} instead.
|
|
752
753
|
*/
|
|
753
|
-
export class SplitZipWriter extends SplitDataWriter {
|
|
754
|
+
export class SplitZipWriter extends SplitDataWriter {}
|
|
754
755
|
|
|
755
756
|
/**
|
|
756
757
|
* Represents a {@link Writer} instance used to retrieve the written data from a generator of {@link WritableWriter} instances (i.e. split zip files).
|
|
@@ -775,14 +776,14 @@ export class SplitDataWriter implements Initializable, WritableWriter {
|
|
|
775
776
|
Writer<unknown> | WritableWriter | WritableStream,
|
|
776
777
|
boolean
|
|
777
778
|
>,
|
|
778
|
-
maxSize?: number
|
|
779
|
+
maxSize?: number
|
|
779
780
|
);
|
|
780
781
|
}
|
|
781
782
|
|
|
782
783
|
/**
|
|
783
784
|
* Represents a {@link Writer} instance used to retrieve the written data as a `Uint8Array` instance.
|
|
784
785
|
*/
|
|
785
|
-
export class Uint8ArrayWriter extends Writer<Uint8Array> {
|
|
786
|
+
export class Uint8ArrayWriter extends Writer<Uint8Array> {}
|
|
786
787
|
|
|
787
788
|
/**
|
|
788
789
|
* Represents an instance used to create an unzipped stream.
|
|
@@ -873,7 +874,7 @@ export class ZipReader<Type> {
|
|
|
873
874
|
| Reader<unknown>[]
|
|
874
875
|
| ReadableReader[]
|
|
875
876
|
| ReadableStream[],
|
|
876
|
-
options?: ZipReaderConstructorOptions
|
|
877
|
+
options?: ZipReaderConstructorOptions
|
|
877
878
|
);
|
|
878
879
|
/**
|
|
879
880
|
* The global comment of the zip file.
|
|
@@ -901,7 +902,7 @@ export class ZipReader<Type> {
|
|
|
901
902
|
* @returns An asynchronous generator of {@link Entry} instances.
|
|
902
903
|
*/
|
|
903
904
|
getEntriesGenerator(
|
|
904
|
-
options?: ZipReaderGetEntriesOptions
|
|
905
|
+
options?: ZipReaderGetEntriesOptions
|
|
905
906
|
): AsyncGenerator<Entry, boolean>;
|
|
906
907
|
/**
|
|
907
908
|
* Closes the zip file
|
|
@@ -913,7 +914,9 @@ export class ZipReader<Type> {
|
|
|
913
914
|
* Represents the options passed to the constructor of {@link ZipReader}, and `{@link ZipDirectory}#import*`.
|
|
914
915
|
*/
|
|
915
916
|
export interface ZipReaderConstructorOptions
|
|
916
|
-
extends ZipReaderOptions,
|
|
917
|
+
extends ZipReaderOptions,
|
|
918
|
+
GetEntriesOptions,
|
|
919
|
+
WorkerConfiguration {
|
|
917
920
|
/**
|
|
918
921
|
* `true` to extract the prepended data into {@link ZipReader#prependedData}.
|
|
919
922
|
*
|
|
@@ -932,7 +935,8 @@ export interface ZipReaderConstructorOptions
|
|
|
932
935
|
* Represents the options passed to {@link ZipReader#getEntries} and {@link ZipReader#getEntriesGenerator}.
|
|
933
936
|
*/
|
|
934
937
|
export interface ZipReaderGetEntriesOptions
|
|
935
|
-
extends GetEntriesOptions,
|
|
938
|
+
extends GetEntriesOptions,
|
|
939
|
+
EntryOnprogressOptions {}
|
|
936
940
|
|
|
937
941
|
/**
|
|
938
942
|
* Represents options passed to the constructor of {@link ZipReader}, {@link ZipReader#getEntries} and {@link ZipReader#getEntriesGenerator}.
|
|
@@ -1089,7 +1093,7 @@ export interface EntryMetaData {
|
|
|
1089
1093
|
/**
|
|
1090
1094
|
* The extra field.
|
|
1091
1095
|
*/
|
|
1092
|
-
extraField?: Map<number, { type: number
|
|
1096
|
+
extraField?: Map<number, { type: number; data: Uint8Array }>;
|
|
1093
1097
|
/**
|
|
1094
1098
|
* The extra field (raw).
|
|
1095
1099
|
*/
|
|
@@ -1140,12 +1144,12 @@ export interface EntryMetaData {
|
|
|
1140
1144
|
*/
|
|
1141
1145
|
compressionMethod: number;
|
|
1142
1146
|
}
|
|
1143
|
-
export interface DirectoryEntry extends Omit<EntryMetaData,
|
|
1147
|
+
export interface DirectoryEntry extends Omit<EntryMetaData, "directory"> {
|
|
1144
1148
|
directory: true;
|
|
1145
1149
|
getData?: undefined;
|
|
1146
1150
|
}
|
|
1147
1151
|
|
|
1148
|
-
export interface FileEntry extends Omit<EntryMetaData,
|
|
1152
|
+
export interface FileEntry extends Omit<EntryMetaData, "directory"> {
|
|
1149
1153
|
directory: false;
|
|
1150
1154
|
/**
|
|
1151
1155
|
* Returns the content of the entry
|
|
@@ -1160,11 +1164,18 @@ export interface FileEntry extends Omit<EntryMetaData, 'directory'> {
|
|
|
1160
1164
|
| WritableWriter
|
|
1161
1165
|
| WritableStream
|
|
1162
1166
|
| AsyncGenerator<
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1167
|
+
Writer<unknown> | WritableWriter | WritableStream,
|
|
1168
|
+
boolean
|
|
1169
|
+
>,
|
|
1166
1170
|
options?: EntryGetDataCheckPasswordOptions
|
|
1167
1171
|
): Promise<Type>;
|
|
1172
|
+
/**
|
|
1173
|
+
* Retrieves the content of the entry as an `ArrayBuffer` instance
|
|
1174
|
+
*
|
|
1175
|
+
* @param options The options.
|
|
1176
|
+
* @returns A promise resolving to an `ArrayBuffer` instance.
|
|
1177
|
+
*/
|
|
1178
|
+
arrayBuffer(options?: EntryGetDataOptions): Promise<ArrayBuffer>;
|
|
1168
1179
|
}
|
|
1169
1180
|
|
|
1170
1181
|
/**
|
|
@@ -1192,13 +1203,14 @@ export type Entry = DirectoryEntry | FileEntry;
|
|
|
1192
1203
|
* Represents the options passed to {@link FileEntry#getData} and `{@link ZipFileEntry}.get*`.
|
|
1193
1204
|
*/
|
|
1194
1205
|
export interface EntryGetDataOptions
|
|
1195
|
-
extends EntryDataOnprogressOptions,
|
|
1206
|
+
extends EntryDataOnprogressOptions,
|
|
1207
|
+
ZipReaderOptions,
|
|
1208
|
+
WorkerConfiguration {}
|
|
1196
1209
|
|
|
1197
1210
|
/**
|
|
1198
1211
|
* Represents the options passed to {@link FileEntry#getData} and `{@link ZipFileEntry}.get*`.
|
|
1199
1212
|
*/
|
|
1200
|
-
export interface EntryGetDataCheckPasswordOptions
|
|
1201
|
-
extends EntryGetDataOptions { }
|
|
1213
|
+
export interface EntryGetDataCheckPasswordOptions extends EntryGetDataOptions {}
|
|
1202
1214
|
|
|
1203
1215
|
/**
|
|
1204
1216
|
* Represents an instance used to create a zipped stream.
|
|
@@ -1260,9 +1272,10 @@ export class ZipWriterStream {
|
|
|
1260
1272
|
* @param path The name of the stream when unzipped.
|
|
1261
1273
|
* @returns An object containing readable and writable properties
|
|
1262
1274
|
*/
|
|
1263
|
-
transform<T>(
|
|
1264
|
-
|
|
1265
|
-
|
|
1275
|
+
transform<T>(path: string): {
|
|
1276
|
+
readable: ReadableStream<T>;
|
|
1277
|
+
writable: WritableStream<T>;
|
|
1278
|
+
};
|
|
1266
1279
|
|
|
1267
1280
|
/**
|
|
1268
1281
|
* Returns a WritableStream for the .pipeTo method
|
|
@@ -1281,7 +1294,7 @@ export class ZipWriterStream {
|
|
|
1281
1294
|
*/
|
|
1282
1295
|
close(
|
|
1283
1296
|
comment?: Uint8Array,
|
|
1284
|
-
options?: ZipWriterCloseOptions
|
|
1297
|
+
options?: ZipWriterCloseOptions
|
|
1285
1298
|
): Promise<unknown>;
|
|
1286
1299
|
}
|
|
1287
1300
|
|
|
@@ -1318,15 +1331,33 @@ export class ZipWriter<Type> {
|
|
|
1318
1331
|
| WritableWriter
|
|
1319
1332
|
| WritableStream
|
|
1320
1333
|
| AsyncGenerator<
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
options?: ZipWriterConstructorOptions
|
|
1334
|
+
Writer<unknown> | WritableWriter | WritableStream,
|
|
1335
|
+
boolean
|
|
1336
|
+
>,
|
|
1337
|
+
options?: ZipWriterConstructorOptions
|
|
1325
1338
|
);
|
|
1326
1339
|
/**
|
|
1327
1340
|
* `true` if the zip contains at least one entry that has been partially written.
|
|
1328
1341
|
*/
|
|
1329
1342
|
readonly hasCorruptedEntries?: boolean;
|
|
1343
|
+
|
|
1344
|
+
/**
|
|
1345
|
+
* Adds an existing zip file at the beginning of the current zip. This method
|
|
1346
|
+
* cannot be called after the first call to {@link ZipWriter#add}.
|
|
1347
|
+
*
|
|
1348
|
+
* @param reader The {@link Reader} instance used to read the content of the zip file.
|
|
1349
|
+
* @returns A promise resolving when the zip file has been added.
|
|
1350
|
+
*/
|
|
1351
|
+
prependZip<ReaderType>(
|
|
1352
|
+
reader:
|
|
1353
|
+
| Reader<ReaderType>
|
|
1354
|
+
| ReadableReader
|
|
1355
|
+
| ReadableStream
|
|
1356
|
+
| Reader<unknown>[]
|
|
1357
|
+
| ReadableReader[]
|
|
1358
|
+
| ReadableStream[]
|
|
1359
|
+
): Promise<void>;
|
|
1360
|
+
|
|
1330
1361
|
/**
|
|
1331
1362
|
* Adds an entry into the zip file
|
|
1332
1363
|
*
|
|
@@ -1344,8 +1375,18 @@ export class ZipWriter<Type> {
|
|
|
1344
1375
|
| Reader<unknown>[]
|
|
1345
1376
|
| ReadableReader[]
|
|
1346
1377
|
| ReadableStream[],
|
|
1347
|
-
options?: ZipWriterAddDataOptions
|
|
1378
|
+
options?: ZipWriterAddDataOptions
|
|
1348
1379
|
): Promise<EntryMetaData>;
|
|
1380
|
+
|
|
1381
|
+
/**
|
|
1382
|
+
* Removes an entry from the zip file. Note that the entry is not removed from the zip file, but it
|
|
1383
|
+
* is not written to the entries directory.
|
|
1384
|
+
*
|
|
1385
|
+
* @param entry The entry to remove. This can be an {@link Entry} instance or the filename of the entry.
|
|
1386
|
+
* @returns `true` if the entry has been removed, `false` otherwise.
|
|
1387
|
+
*/
|
|
1388
|
+
remove(entry: Entry | string): boolean;
|
|
1389
|
+
|
|
1349
1390
|
/**
|
|
1350
1391
|
* Writes the entries directory, writes the global comment, and returns the content of the zip file
|
|
1351
1392
|
*
|
|
@@ -1360,10 +1401,9 @@ export class ZipWriter<Type> {
|
|
|
1360
1401
|
* Represents the options passed to {@link ZipWriter#add}.
|
|
1361
1402
|
*/
|
|
1362
1403
|
export interface ZipWriterAddDataOptions
|
|
1363
|
-
extends
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
WorkerConfiguration {
|
|
1404
|
+
extends ZipWriterConstructorOptions,
|
|
1405
|
+
EntryDataOnprogressOptions,
|
|
1406
|
+
WorkerConfiguration {
|
|
1367
1407
|
/**
|
|
1368
1408
|
* `true` if the entry is a directory.
|
|
1369
1409
|
*
|
|
@@ -1507,7 +1547,8 @@ export interface ZipWriterConstructorOptions {
|
|
|
1507
1547
|
*/
|
|
1508
1548
|
extendedTimestamp?: boolean;
|
|
1509
1549
|
/**
|
|
1510
|
-
* `true` to use the ZipCrypto algorithm to encrypt the content of the entry.
|
|
1550
|
+
* `true` to use the ZipCrypto algorithm to encrypt the content of the entry. Setting it to `true` will also
|
|
1551
|
+
* set the {@link ZipWriterConstructorOptions#dataDescriptor} to `true`.
|
|
1511
1552
|
*
|
|
1512
1553
|
* It is not recommended to set `zipCrypto` to `true` because the ZipCrypto encryption can be easily broken.
|
|
1513
1554
|
*
|
|
@@ -1525,7 +1566,8 @@ export interface ZipWriterConstructorOptions {
|
|
|
1525
1566
|
*/
|
|
1526
1567
|
versionMadeBy?: number;
|
|
1527
1568
|
/**
|
|
1528
|
-
* `true` to mark the file names as UTF-8 setting the general purpose bit 11 in the header (see Appendix D -
|
|
1569
|
+
* `true` to mark the file names as UTF-8 setting the general purpose bit 11 in the header (see Appendix D -
|
|
1570
|
+
* Language Encoding (EFS)), `false` to mark the names as compliant with the original IBM Code Page 437.
|
|
1529
1571
|
*
|
|
1530
1572
|
* Note that this does not ensure that the file names are in the correct encoding.
|
|
1531
1573
|
*
|
|
@@ -1535,9 +1577,10 @@ export interface ZipWriterConstructorOptions {
|
|
|
1535
1577
|
/**
|
|
1536
1578
|
* `true` to add a data descriptor.
|
|
1537
1579
|
*
|
|
1538
|
-
* When set to `false`, the {@link ZipWriterConstructorOptions#bufferedWrite} option will automatically be
|
|
1539
|
-
*
|
|
1540
|
-
* @
|
|
1580
|
+
* When set to `false`, the {@link ZipWriterConstructorOptions#bufferedWrite} option will automatically be
|
|
1581
|
+
* set to `true`. It will be automatically set to `false` when it is `undefined` and the
|
|
1582
|
+
* {@link ZipWriterConstructorOptions#bufferedWrite} option is set to `true`, or ` when the
|
|
1583
|
+
* {@link ZipWriterConstructorOptions#zipCrypto} option is set to `true`. Otherwise, the default value is `true`.
|
|
1541
1584
|
*/
|
|
1542
1585
|
dataDescriptor?: boolean;
|
|
1543
1586
|
/**
|
|
@@ -1591,7 +1634,7 @@ export interface ZipWriterConstructorOptions {
|
|
|
1591
1634
|
/**
|
|
1592
1635
|
* The compression method (e.g. 8 for DEFLATE, 0 for STORE).
|
|
1593
1636
|
*/
|
|
1594
|
-
compressionMethod?: number
|
|
1637
|
+
compressionMethod?: number;
|
|
1595
1638
|
/**
|
|
1596
1639
|
* The function called for encoding the filename and the comment of the entry.
|
|
1597
1640
|
*
|
|
@@ -1644,7 +1687,7 @@ export interface EntryOnprogressOptions {
|
|
|
1644
1687
|
onprogress?(
|
|
1645
1688
|
progress: number,
|
|
1646
1689
|
total: number,
|
|
1647
|
-
entry: EntryMetaData
|
|
1690
|
+
entry: EntryMetaData
|
|
1648
1691
|
): Promise<void> | undefined;
|
|
1649
1692
|
}
|
|
1650
1693
|
|
|
@@ -1705,7 +1748,7 @@ declare class ZipEntry {
|
|
|
1705
1748
|
*/
|
|
1706
1749
|
checkPassword(
|
|
1707
1750
|
password: string,
|
|
1708
|
-
options?: EntryGetDataOptions
|
|
1751
|
+
options?: EntryGetDataOptions
|
|
1709
1752
|
): Promise<boolean>;
|
|
1710
1753
|
/**
|
|
1711
1754
|
* Set the name of the entry
|
|
@@ -1766,7 +1809,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1766
1809
|
*/
|
|
1767
1810
|
getData64URI(
|
|
1768
1811
|
mimeType?: string,
|
|
1769
|
-
options?: EntryGetDataOptions
|
|
1812
|
+
options?: EntryGetDataOptions
|
|
1770
1813
|
): Promise<string>;
|
|
1771
1814
|
/**
|
|
1772
1815
|
* Retrieves the content of the entry as a `Uint8Array` instance
|
|
@@ -1784,7 +1827,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1784
1827
|
*/
|
|
1785
1828
|
getWritable(
|
|
1786
1829
|
writable?: WritableStream,
|
|
1787
|
-
options?: EntryGetDataOptions
|
|
1830
|
+
options?: EntryGetDataOptions
|
|
1788
1831
|
): Promise<WritableStream>;
|
|
1789
1832
|
/**
|
|
1790
1833
|
* Retrieves the content of the entry via a {@link Writer} instance
|
|
@@ -1793,14 +1836,21 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1793
1836
|
* @param options The options.
|
|
1794
1837
|
* @returns A promise resolving to data associated to the {@link Writer} instance.
|
|
1795
1838
|
*/
|
|
1796
|
-
getData(
|
|
1839
|
+
getData<Type>(
|
|
1797
1840
|
writer:
|
|
1798
1841
|
| Writer<unknown>
|
|
1799
1842
|
| WritableWriter
|
|
1800
1843
|
| WritableStream
|
|
1801
1844
|
| AsyncGenerator<Writer<unknown> | WritableWriter | WritableStream>,
|
|
1802
|
-
options?: EntryGetDataOptions
|
|
1803
|
-
): Promise<
|
|
1845
|
+
options?: EntryGetDataOptions
|
|
1846
|
+
): Promise<Type>;
|
|
1847
|
+
/**
|
|
1848
|
+
* Retrieves the content of the entry as an `ArrayBuffer` instance
|
|
1849
|
+
*
|
|
1850
|
+
* @param options The options.
|
|
1851
|
+
* @returns A promise resolving to an `ArrayBuffer` instance.
|
|
1852
|
+
*/
|
|
1853
|
+
getArrayBuffer(options?: EntryGetDataOptions): Promise<ArrayBuffer>;
|
|
1804
1854
|
/**
|
|
1805
1855
|
* Replaces the content of the entry with a `Blob` instance
|
|
1806
1856
|
*
|
|
@@ -1857,7 +1907,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1857
1907
|
*/
|
|
1858
1908
|
addDirectory(
|
|
1859
1909
|
name: string,
|
|
1860
|
-
options?: ZipWriterAddDataOptions
|
|
1910
|
+
options?: ZipWriterAddDataOptions
|
|
1861
1911
|
): ZipDirectoryEntry;
|
|
1862
1912
|
/**
|
|
1863
1913
|
* Adds an entry with content provided as text
|
|
@@ -1870,7 +1920,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1870
1920
|
addText(
|
|
1871
1921
|
name: string,
|
|
1872
1922
|
text: string,
|
|
1873
|
-
options?: ZipWriterAddDataOptions
|
|
1923
|
+
options?: ZipWriterAddDataOptions
|
|
1874
1924
|
): ZipFileEntry<string, string>;
|
|
1875
1925
|
/**
|
|
1876
1926
|
* Adds a entry entry with content provided as a `Blob` instance
|
|
@@ -1883,7 +1933,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1883
1933
|
addBlob(
|
|
1884
1934
|
name: string,
|
|
1885
1935
|
blob: Blob,
|
|
1886
|
-
options?: ZipWriterAddDataOptions
|
|
1936
|
+
options?: ZipWriterAddDataOptions
|
|
1887
1937
|
): ZipFileEntry<Blob, Blob>;
|
|
1888
1938
|
/**
|
|
1889
1939
|
* Adds a entry entry with content provided as a Data URI `string` encoded in Base64
|
|
@@ -1896,7 +1946,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1896
1946
|
addData64URI(
|
|
1897
1947
|
name: string,
|
|
1898
1948
|
dataURI: string,
|
|
1899
|
-
options?: ZipWriterAddDataOptions
|
|
1949
|
+
options?: ZipWriterAddDataOptions
|
|
1900
1950
|
): ZipFileEntry<string, string>;
|
|
1901
1951
|
/**
|
|
1902
1952
|
* Adds an entry with content provided as a `Uint8Array` instance
|
|
@@ -1909,7 +1959,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1909
1959
|
addUint8Array(
|
|
1910
1960
|
name: string,
|
|
1911
1961
|
array: Uint8Array,
|
|
1912
|
-
options?: ZipWriterAddDataOptions
|
|
1962
|
+
options?: ZipWriterAddDataOptions
|
|
1913
1963
|
): ZipFileEntry<Uint8Array, Uint8Array>;
|
|
1914
1964
|
/**
|
|
1915
1965
|
* Adds an entry with content fetched from a URL
|
|
@@ -1922,7 +1972,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1922
1972
|
addHttpContent(
|
|
1923
1973
|
name: string,
|
|
1924
1974
|
url: string,
|
|
1925
|
-
options?: HttpOptions & ZipWriterAddDataOptions
|
|
1975
|
+
options?: HttpOptions & ZipWriterAddDataOptions
|
|
1926
1976
|
): ZipFileEntry<string, void>;
|
|
1927
1977
|
/**
|
|
1928
1978
|
* Adds a entry entry with content provided via a `ReadableStream` instance
|
|
@@ -1935,7 +1985,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1935
1985
|
addReadable(
|
|
1936
1986
|
name: string,
|
|
1937
1987
|
readable: ReadableStream,
|
|
1938
|
-
options?: ZipWriterAddDataOptions
|
|
1988
|
+
options?: ZipWriterAddDataOptions
|
|
1939
1989
|
): ZipFileEntry<ReadableStream, void>;
|
|
1940
1990
|
/**
|
|
1941
1991
|
* Adds an entry with content provided via a `File` instance
|
|
@@ -1944,10 +1994,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1944
1994
|
* @param options The options.
|
|
1945
1995
|
* @returns A promise resolving to a {@link ZipFileEntry} or a {@link ZipDirectoryEntry} instance.
|
|
1946
1996
|
*/
|
|
1947
|
-
addFile(
|
|
1948
|
-
file: File,
|
|
1949
|
-
options?: ZipWriterAddDataOptions,
|
|
1950
|
-
): Promise<ZipEntry>;
|
|
1997
|
+
addFile(file: File, options?: ZipWriterAddDataOptions): Promise<ZipEntry>;
|
|
1951
1998
|
/**
|
|
1952
1999
|
* Adds an entry with content provided via a `FileSystemEntry` instance
|
|
1953
2000
|
*
|
|
@@ -1957,7 +2004,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1957
2004
|
*/
|
|
1958
2005
|
addFileSystemEntry(
|
|
1959
2006
|
fileSystemEntry: FileSystemEntryLike,
|
|
1960
|
-
options?: ZipWriterAddDataOptions
|
|
2007
|
+
options?: ZipWriterAddDataOptions
|
|
1961
2008
|
): Promise<ZipEntry[]>;
|
|
1962
2009
|
/**
|
|
1963
2010
|
* Adds an entry with content provided via a `FileSystemHandle` instance
|
|
@@ -1968,7 +2015,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1968
2015
|
*/
|
|
1969
2016
|
addFileSystemHandle(
|
|
1970
2017
|
fileSystemHandle: FileSystemHandleLike,
|
|
1971
|
-
options?: ZipWriterAddDataOptions
|
|
2018
|
+
options?: ZipWriterAddDataOptions
|
|
1972
2019
|
): Promise<ZipEntry[]>;
|
|
1973
2020
|
/**
|
|
1974
2021
|
* Extracts a zip file provided as a `Blob` instance into the entry
|
|
@@ -1978,7 +2025,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1978
2025
|
*/
|
|
1979
2026
|
importBlob(
|
|
1980
2027
|
blob: Blob,
|
|
1981
|
-
options?: ZipReaderConstructorOptions
|
|
2028
|
+
options?: ZipReaderConstructorOptions
|
|
1982
2029
|
): Promise<[ZipEntry]>;
|
|
1983
2030
|
/**
|
|
1984
2031
|
* Extracts a zip file provided as a Data URI `string` encoded in Base64 into the entry
|
|
@@ -1988,7 +2035,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1988
2035
|
*/
|
|
1989
2036
|
importData64URI(
|
|
1990
2037
|
dataURI: string,
|
|
1991
|
-
options?: ZipReaderConstructorOptions
|
|
2038
|
+
options?: ZipReaderConstructorOptions
|
|
1992
2039
|
): Promise<[ZipEntry]>;
|
|
1993
2040
|
/**
|
|
1994
2041
|
* Extracts a zip file provided as a `Uint8Array` instance into the entry
|
|
@@ -1998,7 +2045,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1998
2045
|
*/
|
|
1999
2046
|
importUint8Array(
|
|
2000
2047
|
array: Uint8Array,
|
|
2001
|
-
options?: ZipReaderConstructorOptions
|
|
2048
|
+
options?: ZipReaderConstructorOptions
|
|
2002
2049
|
): Promise<[ZipEntry]>;
|
|
2003
2050
|
/**
|
|
2004
2051
|
* Extracts a zip file fetched from a URL into the entry
|
|
@@ -2008,7 +2055,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2008
2055
|
*/
|
|
2009
2056
|
importHttpContent(
|
|
2010
2057
|
url: string,
|
|
2011
|
-
options?: ZipDirectoryEntryImportHttpOptions
|
|
2058
|
+
options?: ZipDirectoryEntryImportHttpOptions
|
|
2012
2059
|
): Promise<[ZipEntry]>;
|
|
2013
2060
|
/**
|
|
2014
2061
|
* Extracts a zip file provided via a `ReadableStream` instance into the entry
|
|
@@ -2018,7 +2065,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2018
2065
|
*/
|
|
2019
2066
|
importReadable(
|
|
2020
2067
|
readable: ReadableStream,
|
|
2021
|
-
options?: ZipReaderConstructorOptions
|
|
2068
|
+
options?: ZipReaderConstructorOptions
|
|
2022
2069
|
): Promise<[ZipEntry]>;
|
|
2023
2070
|
/**
|
|
2024
2071
|
* Extracts a zip file provided via a custom {@link Reader} instance into the entry
|
|
@@ -2034,7 +2081,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2034
2081
|
| Reader<unknown>[]
|
|
2035
2082
|
| ReadableReader[]
|
|
2036
2083
|
| ReadableStream[],
|
|
2037
|
-
options?: ZipReaderConstructorOptions
|
|
2084
|
+
options?: ZipReaderConstructorOptions
|
|
2038
2085
|
): Promise<[ZipEntry]>;
|
|
2039
2086
|
/**
|
|
2040
2087
|
* Returns a `Blob` instance containing a zip file of the entry and its descendants
|
|
@@ -2057,7 +2104,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2057
2104
|
* @returns A promise resolving to the `Uint8Array` instance.
|
|
2058
2105
|
*/
|
|
2059
2106
|
exportUint8Array(
|
|
2060
|
-
options?: ZipDirectoryEntryExportOptions
|
|
2107
|
+
options?: ZipDirectoryEntryExportOptions
|
|
2061
2108
|
): Promise<Uint8Array>;
|
|
2062
2109
|
/**
|
|
2063
2110
|
* Creates a zip file via a `WritableStream` instance containing the entry and its descendants
|
|
@@ -2068,7 +2115,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2068
2115
|
*/
|
|
2069
2116
|
exportWritable(
|
|
2070
2117
|
writable?: WritableStream,
|
|
2071
|
-
options?: ZipDirectoryEntryExportOptions
|
|
2118
|
+
options?: ZipDirectoryEntryExportOptions
|
|
2072
2119
|
): Promise<WritableStream>;
|
|
2073
2120
|
/**
|
|
2074
2121
|
* Creates a zip file via a custom {@link Writer} instance containing the entry and its descendants
|
|
@@ -2083,7 +2130,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2083
2130
|
| WritableWriter
|
|
2084
2131
|
| WritableStream
|
|
2085
2132
|
| AsyncGenerator<Writer<unknown> | WritableWriter | WritableStream>,
|
|
2086
|
-
options?: ZipDirectoryEntryExportOptions
|
|
2133
|
+
options?: ZipDirectoryEntryExportOptions
|
|
2087
2134
|
): Promise<unknown>;
|
|
2088
2135
|
}
|
|
2089
2136
|
|
|
@@ -2091,13 +2138,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2091
2138
|
* Represents the options passed to {@link ZipDirectoryEntry#importHttpContent}.
|
|
2092
2139
|
*/
|
|
2093
2140
|
export interface ZipDirectoryEntryImportHttpOptions
|
|
2094
|
-
extends ZipReaderConstructorOptions,
|
|
2141
|
+
extends ZipReaderConstructorOptions,
|
|
2142
|
+
HttpOptions {}
|
|
2095
2143
|
|
|
2096
2144
|
/**
|
|
2097
2145
|
* Represents the options passed to `{@link ZipDirectoryEntry}#export*()`.
|
|
2098
2146
|
*/
|
|
2099
2147
|
export interface ZipDirectoryEntryExportOptions
|
|
2100
|
-
extends ZipWriterConstructorOptions,
|
|
2148
|
+
extends ZipWriterConstructorOptions,
|
|
2149
|
+
EntryDataOnprogressOptions {
|
|
2101
2150
|
/**
|
|
2102
2151
|
* `true` to use filenames relative to the entry instead of full filenames.
|
|
2103
2152
|
*/
|
|
@@ -2289,3 +2338,7 @@ export const ERR_UNDEFINED_UNCOMPRESSED_SIZE: string;
|
|
|
2289
2338
|
* Writer not initialized error
|
|
2290
2339
|
*/
|
|
2291
2340
|
export const ERR_WRITER_NOT_INITIALIZED: string;
|
|
2341
|
+
/**
|
|
2342
|
+
* Zip file not empty error
|
|
2343
|
+
*/
|
|
2344
|
+
export const ERR_ZIP_NOT_EMPTY: string;
|