@zip.js/zip.js 2.7.63 → 2.7.64
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/zip-fs-full.js +396 -149
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +396 -149
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +393 -145
- 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 +393 -145
- package/dist/zip.min.js +1 -1
- package/index-fflate.js +2 -1
- package/index.cjs +396 -149
- package/index.d.ts +116 -77
- package/index.js +1 -0
- package/index.min.js +1 -1
- package/lib/core/constants.js +3 -0
- package/lib/core/io.js +1 -0
- package/lib/core/zip-fs-core.js +3 -4
- package/lib/core/zip-reader.js +5 -3
- package/lib/core/zip-writer.js +391 -143
- 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.
|
|
@@ -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,9 +1164,9 @@ 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>;
|
|
1168
1172
|
}
|
|
@@ -1192,13 +1196,14 @@ export type Entry = DirectoryEntry | FileEntry;
|
|
|
1192
1196
|
* Represents the options passed to {@link FileEntry#getData} and `{@link ZipFileEntry}.get*`.
|
|
1193
1197
|
*/
|
|
1194
1198
|
export interface EntryGetDataOptions
|
|
1195
|
-
extends EntryDataOnprogressOptions,
|
|
1199
|
+
extends EntryDataOnprogressOptions,
|
|
1200
|
+
ZipReaderOptions,
|
|
1201
|
+
WorkerConfiguration {}
|
|
1196
1202
|
|
|
1197
1203
|
/**
|
|
1198
1204
|
* Represents the options passed to {@link FileEntry#getData} and `{@link ZipFileEntry}.get*`.
|
|
1199
1205
|
*/
|
|
1200
|
-
export interface EntryGetDataCheckPasswordOptions
|
|
1201
|
-
extends EntryGetDataOptions { }
|
|
1206
|
+
export interface EntryGetDataCheckPasswordOptions extends EntryGetDataOptions {}
|
|
1202
1207
|
|
|
1203
1208
|
/**
|
|
1204
1209
|
* Represents an instance used to create a zipped stream.
|
|
@@ -1260,9 +1265,10 @@ export class ZipWriterStream {
|
|
|
1260
1265
|
* @param path The name of the stream when unzipped.
|
|
1261
1266
|
* @returns An object containing readable and writable properties
|
|
1262
1267
|
*/
|
|
1263
|
-
transform<T>(
|
|
1264
|
-
|
|
1265
|
-
|
|
1268
|
+
transform<T>(path: string): {
|
|
1269
|
+
readable: ReadableStream<T>;
|
|
1270
|
+
writable: WritableStream<T>;
|
|
1271
|
+
};
|
|
1266
1272
|
|
|
1267
1273
|
/**
|
|
1268
1274
|
* Returns a WritableStream for the .pipeTo method
|
|
@@ -1281,7 +1287,7 @@ export class ZipWriterStream {
|
|
|
1281
1287
|
*/
|
|
1282
1288
|
close(
|
|
1283
1289
|
comment?: Uint8Array,
|
|
1284
|
-
options?: ZipWriterCloseOptions
|
|
1290
|
+
options?: ZipWriterCloseOptions
|
|
1285
1291
|
): Promise<unknown>;
|
|
1286
1292
|
}
|
|
1287
1293
|
|
|
@@ -1318,15 +1324,33 @@ export class ZipWriter<Type> {
|
|
|
1318
1324
|
| WritableWriter
|
|
1319
1325
|
| WritableStream
|
|
1320
1326
|
| AsyncGenerator<
|
|
1321
|
-
|
|
1322
|
-
|
|
1323
|
-
|
|
1324
|
-
options?: ZipWriterConstructorOptions
|
|
1327
|
+
Writer<unknown> | WritableWriter | WritableStream,
|
|
1328
|
+
boolean
|
|
1329
|
+
>,
|
|
1330
|
+
options?: ZipWriterConstructorOptions
|
|
1325
1331
|
);
|
|
1326
1332
|
/**
|
|
1327
1333
|
* `true` if the zip contains at least one entry that has been partially written.
|
|
1328
1334
|
*/
|
|
1329
1335
|
readonly hasCorruptedEntries?: boolean;
|
|
1336
|
+
|
|
1337
|
+
/**
|
|
1338
|
+
* Adds an existing zip file at the beginning of the current zip. This method
|
|
1339
|
+
* cannot be called after the first call to {@link ZipWriter#add}.
|
|
1340
|
+
*
|
|
1341
|
+
* @param reader The {@link Reader} instance used to read the content of the zip file.
|
|
1342
|
+
* @returns A promise resolving when the zip file has been added.
|
|
1343
|
+
*/
|
|
1344
|
+
prependZip<ReaderType>(
|
|
1345
|
+
reader:
|
|
1346
|
+
| Reader<ReaderType>
|
|
1347
|
+
| ReadableReader
|
|
1348
|
+
| ReadableStream
|
|
1349
|
+
| Reader<unknown>[]
|
|
1350
|
+
| ReadableReader[]
|
|
1351
|
+
| ReadableStream[]
|
|
1352
|
+
): Promise<void>;
|
|
1353
|
+
|
|
1330
1354
|
/**
|
|
1331
1355
|
* Adds an entry into the zip file
|
|
1332
1356
|
*
|
|
@@ -1344,8 +1368,18 @@ export class ZipWriter<Type> {
|
|
|
1344
1368
|
| Reader<unknown>[]
|
|
1345
1369
|
| ReadableReader[]
|
|
1346
1370
|
| ReadableStream[],
|
|
1347
|
-
options?: ZipWriterAddDataOptions
|
|
1371
|
+
options?: ZipWriterAddDataOptions
|
|
1348
1372
|
): Promise<EntryMetaData>;
|
|
1373
|
+
|
|
1374
|
+
/**
|
|
1375
|
+
* Removes an entry from the zip file. Note that the entry is not removed from the zip file, but it
|
|
1376
|
+
* is not written to the entries directory.
|
|
1377
|
+
*
|
|
1378
|
+
* @param entry The entry to remove. This can be an {@link Entry} instance or the filename of the entry.
|
|
1379
|
+
* @returns `true` if the entry has been removed, `false` otherwise.
|
|
1380
|
+
*/
|
|
1381
|
+
remove(entry: Entry | string): boolean;
|
|
1382
|
+
|
|
1349
1383
|
/**
|
|
1350
1384
|
* Writes the entries directory, writes the global comment, and returns the content of the zip file
|
|
1351
1385
|
*
|
|
@@ -1360,10 +1394,9 @@ export class ZipWriter<Type> {
|
|
|
1360
1394
|
* Represents the options passed to {@link ZipWriter#add}.
|
|
1361
1395
|
*/
|
|
1362
1396
|
export interface ZipWriterAddDataOptions
|
|
1363
|
-
extends
|
|
1364
|
-
|
|
1365
|
-
|
|
1366
|
-
WorkerConfiguration {
|
|
1397
|
+
extends ZipWriterConstructorOptions,
|
|
1398
|
+
EntryDataOnprogressOptions,
|
|
1399
|
+
WorkerConfiguration {
|
|
1367
1400
|
/**
|
|
1368
1401
|
* `true` if the entry is a directory.
|
|
1369
1402
|
*
|
|
@@ -1507,7 +1540,8 @@ export interface ZipWriterConstructorOptions {
|
|
|
1507
1540
|
*/
|
|
1508
1541
|
extendedTimestamp?: boolean;
|
|
1509
1542
|
/**
|
|
1510
|
-
* `true` to use the ZipCrypto algorithm to encrypt the content of the entry.
|
|
1543
|
+
* `true` to use the ZipCrypto algorithm to encrypt the content of the entry. Setting it to `true` will also
|
|
1544
|
+
* set the {@link ZipWriterConstructorOptions#dataDescriptor} to `true`.
|
|
1511
1545
|
*
|
|
1512
1546
|
* It is not recommended to set `zipCrypto` to `true` because the ZipCrypto encryption can be easily broken.
|
|
1513
1547
|
*
|
|
@@ -1525,7 +1559,8 @@ export interface ZipWriterConstructorOptions {
|
|
|
1525
1559
|
*/
|
|
1526
1560
|
versionMadeBy?: number;
|
|
1527
1561
|
/**
|
|
1528
|
-
* `true` to mark the file names as UTF-8 setting the general purpose bit 11 in the header (see Appendix D -
|
|
1562
|
+
* `true` to mark the file names as UTF-8 setting the general purpose bit 11 in the header (see Appendix D -
|
|
1563
|
+
* Language Encoding (EFS)), `false` to mark the names as compliant with the original IBM Code Page 437.
|
|
1529
1564
|
*
|
|
1530
1565
|
* Note that this does not ensure that the file names are in the correct encoding.
|
|
1531
1566
|
*
|
|
@@ -1535,9 +1570,10 @@ export interface ZipWriterConstructorOptions {
|
|
|
1535
1570
|
/**
|
|
1536
1571
|
* `true` to add a data descriptor.
|
|
1537
1572
|
*
|
|
1538
|
-
* When set to `false`, the {@link ZipWriterConstructorOptions#bufferedWrite} option will automatically be
|
|
1539
|
-
*
|
|
1540
|
-
* @
|
|
1573
|
+
* When set to `false`, the {@link ZipWriterConstructorOptions#bufferedWrite} option will automatically be
|
|
1574
|
+
* set to `true`. It will be automatically set to `false` when it is `undefined` and the
|
|
1575
|
+
* {@link ZipWriterConstructorOptions#bufferedWrite} option is set to `true`, or ` when the
|
|
1576
|
+
* {@link ZipWriterConstructorOptions#zipCrypto} option is set to `true`. Otherwise, the default value is `true`.
|
|
1541
1577
|
*/
|
|
1542
1578
|
dataDescriptor?: boolean;
|
|
1543
1579
|
/**
|
|
@@ -1591,7 +1627,7 @@ export interface ZipWriterConstructorOptions {
|
|
|
1591
1627
|
/**
|
|
1592
1628
|
* The compression method (e.g. 8 for DEFLATE, 0 for STORE).
|
|
1593
1629
|
*/
|
|
1594
|
-
compressionMethod?: number
|
|
1630
|
+
compressionMethod?: number;
|
|
1595
1631
|
/**
|
|
1596
1632
|
* The function called for encoding the filename and the comment of the entry.
|
|
1597
1633
|
*
|
|
@@ -1644,7 +1680,7 @@ export interface EntryOnprogressOptions {
|
|
|
1644
1680
|
onprogress?(
|
|
1645
1681
|
progress: number,
|
|
1646
1682
|
total: number,
|
|
1647
|
-
entry: EntryMetaData
|
|
1683
|
+
entry: EntryMetaData
|
|
1648
1684
|
): Promise<void> | undefined;
|
|
1649
1685
|
}
|
|
1650
1686
|
|
|
@@ -1705,7 +1741,7 @@ declare class ZipEntry {
|
|
|
1705
1741
|
*/
|
|
1706
1742
|
checkPassword(
|
|
1707
1743
|
password: string,
|
|
1708
|
-
options?: EntryGetDataOptions
|
|
1744
|
+
options?: EntryGetDataOptions
|
|
1709
1745
|
): Promise<boolean>;
|
|
1710
1746
|
/**
|
|
1711
1747
|
* Set the name of the entry
|
|
@@ -1766,7 +1802,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1766
1802
|
*/
|
|
1767
1803
|
getData64URI(
|
|
1768
1804
|
mimeType?: string,
|
|
1769
|
-
options?: EntryGetDataOptions
|
|
1805
|
+
options?: EntryGetDataOptions
|
|
1770
1806
|
): Promise<string>;
|
|
1771
1807
|
/**
|
|
1772
1808
|
* Retrieves the content of the entry as a `Uint8Array` instance
|
|
@@ -1784,7 +1820,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1784
1820
|
*/
|
|
1785
1821
|
getWritable(
|
|
1786
1822
|
writable?: WritableStream,
|
|
1787
|
-
options?: EntryGetDataOptions
|
|
1823
|
+
options?: EntryGetDataOptions
|
|
1788
1824
|
): Promise<WritableStream>;
|
|
1789
1825
|
/**
|
|
1790
1826
|
* Retrieves the content of the entry via a {@link Writer} instance
|
|
@@ -1799,7 +1835,7 @@ export class ZipFileEntry<ReaderType, WriterType> extends ZipEntry {
|
|
|
1799
1835
|
| WritableWriter
|
|
1800
1836
|
| WritableStream
|
|
1801
1837
|
| AsyncGenerator<Writer<unknown> | WritableWriter | WritableStream>,
|
|
1802
|
-
options?: EntryGetDataOptions
|
|
1838
|
+
options?: EntryGetDataOptions
|
|
1803
1839
|
): Promise<unknown>;
|
|
1804
1840
|
/**
|
|
1805
1841
|
* Replaces the content of the entry with a `Blob` instance
|
|
@@ -1857,7 +1893,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1857
1893
|
*/
|
|
1858
1894
|
addDirectory(
|
|
1859
1895
|
name: string,
|
|
1860
|
-
options?: ZipWriterAddDataOptions
|
|
1896
|
+
options?: ZipWriterAddDataOptions
|
|
1861
1897
|
): ZipDirectoryEntry;
|
|
1862
1898
|
/**
|
|
1863
1899
|
* Adds an entry with content provided as text
|
|
@@ -1870,7 +1906,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1870
1906
|
addText(
|
|
1871
1907
|
name: string,
|
|
1872
1908
|
text: string,
|
|
1873
|
-
options?: ZipWriterAddDataOptions
|
|
1909
|
+
options?: ZipWriterAddDataOptions
|
|
1874
1910
|
): ZipFileEntry<string, string>;
|
|
1875
1911
|
/**
|
|
1876
1912
|
* Adds a entry entry with content provided as a `Blob` instance
|
|
@@ -1883,7 +1919,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1883
1919
|
addBlob(
|
|
1884
1920
|
name: string,
|
|
1885
1921
|
blob: Blob,
|
|
1886
|
-
options?: ZipWriterAddDataOptions
|
|
1922
|
+
options?: ZipWriterAddDataOptions
|
|
1887
1923
|
): ZipFileEntry<Blob, Blob>;
|
|
1888
1924
|
/**
|
|
1889
1925
|
* Adds a entry entry with content provided as a Data URI `string` encoded in Base64
|
|
@@ -1896,7 +1932,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1896
1932
|
addData64URI(
|
|
1897
1933
|
name: string,
|
|
1898
1934
|
dataURI: string,
|
|
1899
|
-
options?: ZipWriterAddDataOptions
|
|
1935
|
+
options?: ZipWriterAddDataOptions
|
|
1900
1936
|
): ZipFileEntry<string, string>;
|
|
1901
1937
|
/**
|
|
1902
1938
|
* Adds an entry with content provided as a `Uint8Array` instance
|
|
@@ -1909,7 +1945,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1909
1945
|
addUint8Array(
|
|
1910
1946
|
name: string,
|
|
1911
1947
|
array: Uint8Array,
|
|
1912
|
-
options?: ZipWriterAddDataOptions
|
|
1948
|
+
options?: ZipWriterAddDataOptions
|
|
1913
1949
|
): ZipFileEntry<Uint8Array, Uint8Array>;
|
|
1914
1950
|
/**
|
|
1915
1951
|
* Adds an entry with content fetched from a URL
|
|
@@ -1922,7 +1958,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1922
1958
|
addHttpContent(
|
|
1923
1959
|
name: string,
|
|
1924
1960
|
url: string,
|
|
1925
|
-
options?: HttpOptions & ZipWriterAddDataOptions
|
|
1961
|
+
options?: HttpOptions & ZipWriterAddDataOptions
|
|
1926
1962
|
): ZipFileEntry<string, void>;
|
|
1927
1963
|
/**
|
|
1928
1964
|
* Adds a entry entry with content provided via a `ReadableStream` instance
|
|
@@ -1935,7 +1971,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1935
1971
|
addReadable(
|
|
1936
1972
|
name: string,
|
|
1937
1973
|
readable: ReadableStream,
|
|
1938
|
-
options?: ZipWriterAddDataOptions
|
|
1974
|
+
options?: ZipWriterAddDataOptions
|
|
1939
1975
|
): ZipFileEntry<ReadableStream, void>;
|
|
1940
1976
|
/**
|
|
1941
1977
|
* Adds an entry with content provided via a `File` instance
|
|
@@ -1944,10 +1980,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1944
1980
|
* @param options The options.
|
|
1945
1981
|
* @returns A promise resolving to a {@link ZipFileEntry} or a {@link ZipDirectoryEntry} instance.
|
|
1946
1982
|
*/
|
|
1947
|
-
addFile(
|
|
1948
|
-
file: File,
|
|
1949
|
-
options?: ZipWriterAddDataOptions,
|
|
1950
|
-
): Promise<ZipEntry>;
|
|
1983
|
+
addFile(file: File, options?: ZipWriterAddDataOptions): Promise<ZipEntry>;
|
|
1951
1984
|
/**
|
|
1952
1985
|
* Adds an entry with content provided via a `FileSystemEntry` instance
|
|
1953
1986
|
*
|
|
@@ -1957,7 +1990,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1957
1990
|
*/
|
|
1958
1991
|
addFileSystemEntry(
|
|
1959
1992
|
fileSystemEntry: FileSystemEntryLike,
|
|
1960
|
-
options?: ZipWriterAddDataOptions
|
|
1993
|
+
options?: ZipWriterAddDataOptions
|
|
1961
1994
|
): Promise<ZipEntry[]>;
|
|
1962
1995
|
/**
|
|
1963
1996
|
* Adds an entry with content provided via a `FileSystemHandle` instance
|
|
@@ -1968,7 +2001,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1968
2001
|
*/
|
|
1969
2002
|
addFileSystemHandle(
|
|
1970
2003
|
fileSystemHandle: FileSystemHandleLike,
|
|
1971
|
-
options?: ZipWriterAddDataOptions
|
|
2004
|
+
options?: ZipWriterAddDataOptions
|
|
1972
2005
|
): Promise<ZipEntry[]>;
|
|
1973
2006
|
/**
|
|
1974
2007
|
* Extracts a zip file provided as a `Blob` instance into the entry
|
|
@@ -1978,7 +2011,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1978
2011
|
*/
|
|
1979
2012
|
importBlob(
|
|
1980
2013
|
blob: Blob,
|
|
1981
|
-
options?: ZipReaderConstructorOptions
|
|
2014
|
+
options?: ZipReaderConstructorOptions
|
|
1982
2015
|
): Promise<[ZipEntry]>;
|
|
1983
2016
|
/**
|
|
1984
2017
|
* Extracts a zip file provided as a Data URI `string` encoded in Base64 into the entry
|
|
@@ -1988,7 +2021,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1988
2021
|
*/
|
|
1989
2022
|
importData64URI(
|
|
1990
2023
|
dataURI: string,
|
|
1991
|
-
options?: ZipReaderConstructorOptions
|
|
2024
|
+
options?: ZipReaderConstructorOptions
|
|
1992
2025
|
): Promise<[ZipEntry]>;
|
|
1993
2026
|
/**
|
|
1994
2027
|
* Extracts a zip file provided as a `Uint8Array` instance into the entry
|
|
@@ -1998,7 +2031,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
1998
2031
|
*/
|
|
1999
2032
|
importUint8Array(
|
|
2000
2033
|
array: Uint8Array,
|
|
2001
|
-
options?: ZipReaderConstructorOptions
|
|
2034
|
+
options?: ZipReaderConstructorOptions
|
|
2002
2035
|
): Promise<[ZipEntry]>;
|
|
2003
2036
|
/**
|
|
2004
2037
|
* Extracts a zip file fetched from a URL into the entry
|
|
@@ -2008,7 +2041,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2008
2041
|
*/
|
|
2009
2042
|
importHttpContent(
|
|
2010
2043
|
url: string,
|
|
2011
|
-
options?: ZipDirectoryEntryImportHttpOptions
|
|
2044
|
+
options?: ZipDirectoryEntryImportHttpOptions
|
|
2012
2045
|
): Promise<[ZipEntry]>;
|
|
2013
2046
|
/**
|
|
2014
2047
|
* Extracts a zip file provided via a `ReadableStream` instance into the entry
|
|
@@ -2018,7 +2051,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2018
2051
|
*/
|
|
2019
2052
|
importReadable(
|
|
2020
2053
|
readable: ReadableStream,
|
|
2021
|
-
options?: ZipReaderConstructorOptions
|
|
2054
|
+
options?: ZipReaderConstructorOptions
|
|
2022
2055
|
): Promise<[ZipEntry]>;
|
|
2023
2056
|
/**
|
|
2024
2057
|
* Extracts a zip file provided via a custom {@link Reader} instance into the entry
|
|
@@ -2034,7 +2067,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2034
2067
|
| Reader<unknown>[]
|
|
2035
2068
|
| ReadableReader[]
|
|
2036
2069
|
| ReadableStream[],
|
|
2037
|
-
options?: ZipReaderConstructorOptions
|
|
2070
|
+
options?: ZipReaderConstructorOptions
|
|
2038
2071
|
): Promise<[ZipEntry]>;
|
|
2039
2072
|
/**
|
|
2040
2073
|
* Returns a `Blob` instance containing a zip file of the entry and its descendants
|
|
@@ -2057,7 +2090,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2057
2090
|
* @returns A promise resolving to the `Uint8Array` instance.
|
|
2058
2091
|
*/
|
|
2059
2092
|
exportUint8Array(
|
|
2060
|
-
options?: ZipDirectoryEntryExportOptions
|
|
2093
|
+
options?: ZipDirectoryEntryExportOptions
|
|
2061
2094
|
): Promise<Uint8Array>;
|
|
2062
2095
|
/**
|
|
2063
2096
|
* Creates a zip file via a `WritableStream` instance containing the entry and its descendants
|
|
@@ -2068,7 +2101,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2068
2101
|
*/
|
|
2069
2102
|
exportWritable(
|
|
2070
2103
|
writable?: WritableStream,
|
|
2071
|
-
options?: ZipDirectoryEntryExportOptions
|
|
2104
|
+
options?: ZipDirectoryEntryExportOptions
|
|
2072
2105
|
): Promise<WritableStream>;
|
|
2073
2106
|
/**
|
|
2074
2107
|
* Creates a zip file via a custom {@link Writer} instance containing the entry and its descendants
|
|
@@ -2083,7 +2116,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2083
2116
|
| WritableWriter
|
|
2084
2117
|
| WritableStream
|
|
2085
2118
|
| AsyncGenerator<Writer<unknown> | WritableWriter | WritableStream>,
|
|
2086
|
-
options?: ZipDirectoryEntryExportOptions
|
|
2119
|
+
options?: ZipDirectoryEntryExportOptions
|
|
2087
2120
|
): Promise<unknown>;
|
|
2088
2121
|
}
|
|
2089
2122
|
|
|
@@ -2091,13 +2124,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
2091
2124
|
* Represents the options passed to {@link ZipDirectoryEntry#importHttpContent}.
|
|
2092
2125
|
*/
|
|
2093
2126
|
export interface ZipDirectoryEntryImportHttpOptions
|
|
2094
|
-
extends ZipReaderConstructorOptions,
|
|
2127
|
+
extends ZipReaderConstructorOptions,
|
|
2128
|
+
HttpOptions {}
|
|
2095
2129
|
|
|
2096
2130
|
/**
|
|
2097
2131
|
* Represents the options passed to `{@link ZipDirectoryEntry}#export*()`.
|
|
2098
2132
|
*/
|
|
2099
2133
|
export interface ZipDirectoryEntryExportOptions
|
|
2100
|
-
extends ZipWriterConstructorOptions,
|
|
2134
|
+
extends ZipWriterConstructorOptions,
|
|
2135
|
+
EntryDataOnprogressOptions {
|
|
2101
2136
|
/**
|
|
2102
2137
|
* `true` to use filenames relative to the entry instead of full filenames.
|
|
2103
2138
|
*/
|
|
@@ -2289,3 +2324,7 @@ export const ERR_UNDEFINED_UNCOMPRESSED_SIZE: string;
|
|
|
2289
2324
|
* Writer not initialized error
|
|
2290
2325
|
*/
|
|
2291
2326
|
export const ERR_WRITER_NOT_INITIALIZED: string;
|
|
2327
|
+
/**
|
|
2328
|
+
* Zip file not empty error
|
|
2329
|
+
*/
|
|
2330
|
+
export const ERR_ZIP_NOT_EMPTY: string;
|