@zip.js/zip.js 2.13.1 → 2.14.0
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/BENCHMARKS.md +46 -1
- package/deno.json +1 -1
- package/dist/zip-core-external.js +559 -924
- package/dist/zip-core-external.min.js +1 -1
- package/dist/zip-core.js +426 -897
- package/dist/zip-core.min.js +1 -1
- package/dist/zip-fs-core-external.js +566 -927
- package/dist/zip-fs-core-external.min.js +1 -1
- package/dist/zip-fs-core.js +433 -900
- package/dist/zip-fs-core.min.js +1 -1
- package/dist/zip-fs-external.js +566 -927
- package/dist/zip-fs-external.min.js +1 -1
- package/dist/zip-fs-native.js +435 -902
- package/dist/zip-fs-native.min.js +1 -1
- package/dist/zip-fs.js +569 -930
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-legacy.js +428 -899
- package/dist/zip-legacy.min.js +1 -1
- package/dist/zip-module.wasm +0 -0
- package/dist/zip-native.js +428 -899
- package/dist/zip-native.min.js +1 -1
- package/dist/zip-web-worker-native.js +1 -1
- package/dist/zip-web-worker.js +1 -1
- package/dist/zip.js +562 -927
- package/dist/zip.min.js +1 -1
- package/index-native.cjs +435 -902
- package/index-native.min.js +1 -1
- package/index.cjs +569 -930
- package/index.d.cts +52 -12
- package/index.d.ts +52 -12
- package/index.min.js +1 -1
- package/lib/core/codec-worker.js +33 -23
- package/lib/core/io.js +29 -21
- package/lib/core/streams/aes-crypto-stream.js +58 -99
- package/lib/core/streams/codecs/aes-hmac-sha1.js +348 -0
- package/lib/core/streams/zlib-wasm/aes-hmac-sha1-wasm.js +106 -0
- package/lib/core/streams/zlib-wasm/zlib-streams-loader.js +4 -0
- package/lib/core/streams/zlib-wasm/zlib-streams.wasm +0 -0
- package/lib/core/version.js +1 -1
- package/lib/core/web-worker-base.js +15 -9
- package/lib/core/web-worker-inline-native.js +1 -1
- package/lib/core/web-worker-inline-wasm.js +1 -1
- package/lib/core/web-worker-wasm.js +2 -0
- package/lib/core/zip-fs.js +7 -3
- package/lib/core/zip-writer.js +1 -2
- package/lib/core/zlib-streams-inline.js +1 -1
- package/lib/zip-module-wasm-base.js +3 -1
- package/package.json +1 -1
- package/lib/core/streams/codecs/sjcl.js +0 -795
package/index.d.cts
CHANGED
|
@@ -1043,7 +1043,13 @@ export interface HttpOptions extends HttpRangeOptions {
|
|
|
1043
1043
|
*/
|
|
1044
1044
|
preventHeadRequest?: boolean;
|
|
1045
1045
|
/**
|
|
1046
|
-
* `true` to
|
|
1046
|
+
* `true` to read the end of the archive with the same request that gives its size, and to serve the later reads
|
|
1047
|
+
* landing in that range from the response instead of requesting them again, make sure beforehand that the server
|
|
1048
|
+
* supports a suffix range request.
|
|
1049
|
+
*
|
|
1050
|
+
* The request asks for the last 65,557 bytes, which is how far back the reader scans for the end of central directory
|
|
1051
|
+
* record, so it fetches nothing the reader was not going to read anyway. An archive shorter than that is fetched
|
|
1052
|
+
* whole, and reading it then costs a single request.
|
|
1047
1053
|
*
|
|
1048
1054
|
* @defaultValue false
|
|
1049
1055
|
*/
|
|
@@ -1108,10 +1114,14 @@ export interface WritableWriter {
|
|
|
1108
1114
|
*/
|
|
1109
1115
|
writable: WritableStream;
|
|
1110
1116
|
/**
|
|
1111
|
-
* The number of bytes written into the instance. It is set to 0 before the first write and
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1117
|
+
* The number of bytes written into the instance. It is set to 0 before the first write, and a value
|
|
1118
|
+
* set beforehand is kept and used as the starting offset instead of being reset to 0.
|
|
1119
|
+
*
|
|
1120
|
+
* The bytes of a section are added once that section is written, so the value is settled between
|
|
1121
|
+
* entries rather than after every chunk: an instance reading it from its own `write()` method sees
|
|
1122
|
+
* the total of the sections already finished. The exception is an instance yielded by a generator of
|
|
1123
|
+
* split disks, which is updated on each chunk written to it, so it can compute the offset of the disk
|
|
1124
|
+
* it is filling.
|
|
1115
1125
|
*
|
|
1116
1126
|
* It must therefore be assignable, see {@link ERR_WRITER_SIZE_NOT_WRITABLE}: a getter with no setter
|
|
1117
1127
|
* is rejected when the writer is passed, not once the first entry has been written.
|
|
@@ -3498,7 +3508,9 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3498
3508
|
* {@link ZipWriterConstructorOptions#bufferedWrite} option is set to `true`, or when the entry is a folder
|
|
3499
3509
|
* or an empty entry stored without compression or encryption, since the header can then carry the sizes and
|
|
3500
3510
|
* the CRC-32 directly. It will be automatically set to `true` when the
|
|
3501
|
-
* {@link ZipWriterConstructorOptions#zipCrypto} option is set to `true
|
|
3511
|
+
* {@link ZipWriterConstructorOptions#zipCrypto} option is set to `true`, except for such a folder or empty
|
|
3512
|
+
* entry, which holds no encrypted data and therefore needs no descriptor either. Otherwise, the default
|
|
3513
|
+
* value is `true`.
|
|
3502
3514
|
*/
|
|
3503
3515
|
dataDescriptor?: boolean;
|
|
3504
3516
|
/**
|
|
@@ -4203,6 +4215,9 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4203
4215
|
*
|
|
4204
4216
|
* @param blob The `Blob` instance.
|
|
4205
4217
|
* @param options The options.
|
|
4218
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4219
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4220
|
+
* the filenames.
|
|
4206
4221
|
*
|
|
4207
4222
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4208
4223
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4210,12 +4225,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4210
4225
|
importBlob(
|
|
4211
4226
|
blob: Blob,
|
|
4212
4227
|
options?: ZipDirectoryEntryImportOptions
|
|
4213
|
-
): Promise<[
|
|
4228
|
+
): Promise<ZipEntry[]>;
|
|
4214
4229
|
/**
|
|
4215
4230
|
* Extracts a zip file provided as a Data URI `string` encoded in Base64 into the entry
|
|
4216
4231
|
*
|
|
4217
4232
|
* @param dataURI The Data URI `string` encoded in Base64.
|
|
4218
4233
|
* @param options The options.
|
|
4234
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4235
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4236
|
+
* the filenames.
|
|
4219
4237
|
*
|
|
4220
4238
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4221
4239
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4223,12 +4241,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4223
4241
|
importData64URI(
|
|
4224
4242
|
dataURI: string,
|
|
4225
4243
|
options?: ZipDirectoryEntryImportOptions
|
|
4226
|
-
): Promise<[
|
|
4244
|
+
): Promise<ZipEntry[]>;
|
|
4227
4245
|
/**
|
|
4228
4246
|
* Extracts a zip file provided as a `Uint8Array` instance into the entry
|
|
4229
4247
|
*
|
|
4230
4248
|
* @param array The `Uint8Array` instance.
|
|
4231
4249
|
* @param options The options.
|
|
4250
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4251
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4252
|
+
* the filenames.
|
|
4232
4253
|
*
|
|
4233
4254
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4234
4255
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4236,12 +4257,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4236
4257
|
importUint8Array(
|
|
4237
4258
|
array: Uint8Array,
|
|
4238
4259
|
options?: ZipDirectoryEntryImportOptions
|
|
4239
|
-
): Promise<[
|
|
4260
|
+
): Promise<ZipEntry[]>;
|
|
4240
4261
|
/**
|
|
4241
4262
|
* Extracts a zip file fetched from a URL into the entry
|
|
4242
4263
|
*
|
|
4243
4264
|
* @param url The URL.
|
|
4244
4265
|
* @param options The options.
|
|
4266
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4267
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4268
|
+
* the filenames.
|
|
4245
4269
|
*
|
|
4246
4270
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4247
4271
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4249,12 +4273,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4249
4273
|
importHttpContent(
|
|
4250
4274
|
url: string,
|
|
4251
4275
|
options?: ZipDirectoryEntryImportHttpOptions
|
|
4252
|
-
): Promise<[
|
|
4276
|
+
): Promise<ZipEntry[]>;
|
|
4253
4277
|
/**
|
|
4254
4278
|
* Extracts a zip file provided via a `ReadableStream` instance into the entry
|
|
4255
4279
|
*
|
|
4256
4280
|
* @param readable The `ReadableStream` instance.
|
|
4257
4281
|
* @param options The options.
|
|
4282
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4283
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4284
|
+
* the filenames.
|
|
4258
4285
|
*
|
|
4259
4286
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4260
4287
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4266,13 +4293,16 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4266
4293
|
importReadable(
|
|
4267
4294
|
readable: ReadableStream,
|
|
4268
4295
|
options?: ZipDirectoryEntryImportOptions
|
|
4269
|
-
): Promise<[
|
|
4296
|
+
): Promise<ZipEntry[]>;
|
|
4270
4297
|
/**
|
|
4271
4298
|
* Extracts a zip file provided via a custom {@link Reader} instance or a {@link ZipReader} instance into
|
|
4272
4299
|
* the entry
|
|
4273
4300
|
*
|
|
4274
4301
|
* @param reader The {@link Reader} instance or the {@link ZipReader} instance.
|
|
4275
4302
|
* @param options The options.
|
|
4303
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4304
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4305
|
+
* the filenames.
|
|
4276
4306
|
*
|
|
4277
4307
|
* @remarks The filename of each entry is split into path components to build the tree of entries. Empty
|
|
4278
4308
|
* components and `"."` components are ignored, so `"a//b.txt"`, `"./a/b.txt"` and `"a/./b.txt"` all produce
|
|
@@ -4302,7 +4332,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4302
4332
|
| ReadableStream[]
|
|
4303
4333
|
| ZipReader<unknown>,
|
|
4304
4334
|
options?: ZipDirectoryEntryImportOptions
|
|
4305
|
-
): Promise<[
|
|
4335
|
+
): Promise<ZipEntry[]>;
|
|
4306
4336
|
/**
|
|
4307
4337
|
* Returns a `Blob` instance containing a zip file of the entry and its descendants
|
|
4308
4338
|
*
|
|
@@ -4478,6 +4508,16 @@ export interface ZipDirectoryEntryImportOptions
|
|
|
4478
4508
|
* entry holding the node, which is the behavior of most zip tools. The entries that do not collide
|
|
4479
4509
|
* are imported in both cases.
|
|
4480
4510
|
*
|
|
4511
|
+
* When both entries are directory records, `"keep-last"` replaces the record held by the node and keeps
|
|
4512
|
+
* the entries already imported below it, which belong to the node rather than to either record. A
|
|
4513
|
+
* directory record claiming a node created implicitly by the entries below it is not a collision, it is
|
|
4514
|
+
* the record that node was missing.
|
|
4515
|
+
*
|
|
4516
|
+
* A file claiming a node already holding a directory is the one collision that also drops entries that
|
|
4517
|
+
* did not collide: `"keep-last"` replaces the directory with the file, and the entries below it go with
|
|
4518
|
+
* it, since a file node cannot hold them. `"keep-first"` keeps the directory and its entries and ignores
|
|
4519
|
+
* the file instead, so the two policies are mirrors of each other for that shape.
|
|
4520
|
+
*
|
|
4481
4521
|
* @defaultValue "throw"
|
|
4482
4522
|
*/
|
|
4483
4523
|
duplicates?: "throw" | "keep-first" | "keep-last";
|
package/index.d.ts
CHANGED
|
@@ -1043,7 +1043,13 @@ export interface HttpOptions extends HttpRangeOptions {
|
|
|
1043
1043
|
*/
|
|
1044
1044
|
preventHeadRequest?: boolean;
|
|
1045
1045
|
/**
|
|
1046
|
-
* `true` to
|
|
1046
|
+
* `true` to read the end of the archive with the same request that gives its size, and to serve the later reads
|
|
1047
|
+
* landing in that range from the response instead of requesting them again, make sure beforehand that the server
|
|
1048
|
+
* supports a suffix range request.
|
|
1049
|
+
*
|
|
1050
|
+
* The request asks for the last 65,557 bytes, which is how far back the reader scans for the end of central directory
|
|
1051
|
+
* record, so it fetches nothing the reader was not going to read anyway. An archive shorter than that is fetched
|
|
1052
|
+
* whole, and reading it then costs a single request.
|
|
1047
1053
|
*
|
|
1048
1054
|
* @defaultValue false
|
|
1049
1055
|
*/
|
|
@@ -1108,10 +1114,14 @@ export interface WritableWriter {
|
|
|
1108
1114
|
*/
|
|
1109
1115
|
writable: WritableStream;
|
|
1110
1116
|
/**
|
|
1111
|
-
* The number of bytes written into the instance. It is set to 0 before the first write and
|
|
1112
|
-
*
|
|
1113
|
-
*
|
|
1114
|
-
*
|
|
1117
|
+
* The number of bytes written into the instance. It is set to 0 before the first write, and a value
|
|
1118
|
+
* set beforehand is kept and used as the starting offset instead of being reset to 0.
|
|
1119
|
+
*
|
|
1120
|
+
* The bytes of a section are added once that section is written, so the value is settled between
|
|
1121
|
+
* entries rather than after every chunk: an instance reading it from its own `write()` method sees
|
|
1122
|
+
* the total of the sections already finished. The exception is an instance yielded by a generator of
|
|
1123
|
+
* split disks, which is updated on each chunk written to it, so it can compute the offset of the disk
|
|
1124
|
+
* it is filling.
|
|
1115
1125
|
*
|
|
1116
1126
|
* It must therefore be assignable, see {@link ERR_WRITER_SIZE_NOT_WRITABLE}: a getter with no setter
|
|
1117
1127
|
* is rejected when the writer is passed, not once the first entry has been written.
|
|
@@ -3498,7 +3508,9 @@ export interface ZipWriterConstructorOptions extends WorkerConfiguration {
|
|
|
3498
3508
|
* {@link ZipWriterConstructorOptions#bufferedWrite} option is set to `true`, or when the entry is a folder
|
|
3499
3509
|
* or an empty entry stored without compression or encryption, since the header can then carry the sizes and
|
|
3500
3510
|
* the CRC-32 directly. It will be automatically set to `true` when the
|
|
3501
|
-
* {@link ZipWriterConstructorOptions#zipCrypto} option is set to `true
|
|
3511
|
+
* {@link ZipWriterConstructorOptions#zipCrypto} option is set to `true`, except for such a folder or empty
|
|
3512
|
+
* entry, which holds no encrypted data and therefore needs no descriptor either. Otherwise, the default
|
|
3513
|
+
* value is `true`.
|
|
3502
3514
|
*/
|
|
3503
3515
|
dataDescriptor?: boolean;
|
|
3504
3516
|
/**
|
|
@@ -4203,6 +4215,9 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4203
4215
|
*
|
|
4204
4216
|
* @param blob The `Blob` instance.
|
|
4205
4217
|
* @param options The options.
|
|
4218
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4219
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4220
|
+
* the filenames.
|
|
4206
4221
|
*
|
|
4207
4222
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4208
4223
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4210,12 +4225,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4210
4225
|
importBlob(
|
|
4211
4226
|
blob: Blob,
|
|
4212
4227
|
options?: ZipDirectoryEntryImportOptions
|
|
4213
|
-
): Promise<[
|
|
4228
|
+
): Promise<ZipEntry[]>;
|
|
4214
4229
|
/**
|
|
4215
4230
|
* Extracts a zip file provided as a Data URI `string` encoded in Base64 into the entry
|
|
4216
4231
|
*
|
|
4217
4232
|
* @param dataURI The Data URI `string` encoded in Base64.
|
|
4218
4233
|
* @param options The options.
|
|
4234
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4235
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4236
|
+
* the filenames.
|
|
4219
4237
|
*
|
|
4220
4238
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4221
4239
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4223,12 +4241,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4223
4241
|
importData64URI(
|
|
4224
4242
|
dataURI: string,
|
|
4225
4243
|
options?: ZipDirectoryEntryImportOptions
|
|
4226
|
-
): Promise<[
|
|
4244
|
+
): Promise<ZipEntry[]>;
|
|
4227
4245
|
/**
|
|
4228
4246
|
* Extracts a zip file provided as a `Uint8Array` instance into the entry
|
|
4229
4247
|
*
|
|
4230
4248
|
* @param array The `Uint8Array` instance.
|
|
4231
4249
|
* @param options The options.
|
|
4250
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4251
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4252
|
+
* the filenames.
|
|
4232
4253
|
*
|
|
4233
4254
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4234
4255
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4236,12 +4257,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4236
4257
|
importUint8Array(
|
|
4237
4258
|
array: Uint8Array,
|
|
4238
4259
|
options?: ZipDirectoryEntryImportOptions
|
|
4239
|
-
): Promise<[
|
|
4260
|
+
): Promise<ZipEntry[]>;
|
|
4240
4261
|
/**
|
|
4241
4262
|
* Extracts a zip file fetched from a URL into the entry
|
|
4242
4263
|
*
|
|
4243
4264
|
* @param url The URL.
|
|
4244
4265
|
* @param options The options.
|
|
4266
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4267
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4268
|
+
* the filenames.
|
|
4245
4269
|
*
|
|
4246
4270
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4247
4271
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4249,12 +4273,15 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4249
4273
|
importHttpContent(
|
|
4250
4274
|
url: string,
|
|
4251
4275
|
options?: ZipDirectoryEntryImportHttpOptions
|
|
4252
|
-
): Promise<[
|
|
4276
|
+
): Promise<ZipEntry[]>;
|
|
4253
4277
|
/**
|
|
4254
4278
|
* Extracts a zip file provided via a `ReadableStream` instance into the entry
|
|
4255
4279
|
*
|
|
4256
4280
|
* @param readable The `ReadableStream` instance.
|
|
4257
4281
|
* @param options The options.
|
|
4282
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4283
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4284
|
+
* the filenames.
|
|
4258
4285
|
*
|
|
4259
4286
|
* @remarks Use {@link ZipDirectoryEntry#importZip} with a {@link ZipReader} instance to read the data of the
|
|
4260
4287
|
* zip file itself, e.g. its {@link ZipReader#prependedData} or its {@link ZipReader#comment} property.
|
|
@@ -4266,13 +4293,16 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4266
4293
|
importReadable(
|
|
4267
4294
|
readable: ReadableStream,
|
|
4268
4295
|
options?: ZipDirectoryEntryImportOptions
|
|
4269
|
-
): Promise<[
|
|
4296
|
+
): Promise<ZipEntry[]>;
|
|
4270
4297
|
/**
|
|
4271
4298
|
* Extracts a zip file provided via a custom {@link Reader} instance or a {@link ZipReader} instance into
|
|
4272
4299
|
* the entry
|
|
4273
4300
|
*
|
|
4274
4301
|
* @param reader The {@link Reader} instance or the {@link ZipReader} instance.
|
|
4275
4302
|
* @param options The options.
|
|
4303
|
+
* @returns A promise resolving to an array of the {@link ZipFileEntry} and {@link ZipDirectoryEntry}
|
|
4304
|
+
* instances created by the import, which includes the directories created for the path components of
|
|
4305
|
+
* the filenames.
|
|
4276
4306
|
*
|
|
4277
4307
|
* @remarks The filename of each entry is split into path components to build the tree of entries. Empty
|
|
4278
4308
|
* components and `"."` components are ignored, so `"a//b.txt"`, `"./a/b.txt"` and `"a/./b.txt"` all produce
|
|
@@ -4302,7 +4332,7 @@ export class ZipDirectoryEntry extends ZipEntry {
|
|
|
4302
4332
|
| ReadableStream[]
|
|
4303
4333
|
| ZipReader<unknown>,
|
|
4304
4334
|
options?: ZipDirectoryEntryImportOptions
|
|
4305
|
-
): Promise<[
|
|
4335
|
+
): Promise<ZipEntry[]>;
|
|
4306
4336
|
/**
|
|
4307
4337
|
* Returns a `Blob` instance containing a zip file of the entry and its descendants
|
|
4308
4338
|
*
|
|
@@ -4478,6 +4508,16 @@ export interface ZipDirectoryEntryImportOptions
|
|
|
4478
4508
|
* entry holding the node, which is the behavior of most zip tools. The entries that do not collide
|
|
4479
4509
|
* are imported in both cases.
|
|
4480
4510
|
*
|
|
4511
|
+
* When both entries are directory records, `"keep-last"` replaces the record held by the node and keeps
|
|
4512
|
+
* the entries already imported below it, which belong to the node rather than to either record. A
|
|
4513
|
+
* directory record claiming a node created implicitly by the entries below it is not a collision, it is
|
|
4514
|
+
* the record that node was missing.
|
|
4515
|
+
*
|
|
4516
|
+
* A file claiming a node already holding a directory is the one collision that also drops entries that
|
|
4517
|
+
* did not collide: `"keep-last"` replaces the directory with the file, and the entries below it go with
|
|
4518
|
+
* it, since a file node cannot hold them. `"keep-first"` keeps the directory and its entries and ignores
|
|
4519
|
+
* the file instead, so the two policies are mirrors of each other for that shape.
|
|
4520
|
+
*
|
|
4481
4521
|
* @defaultValue "throw"
|
|
4482
4522
|
*/
|
|
4483
4523
|
duplicates?: "throw" | "keep-first" | "keep-last";
|