@zip.js/zip.js 2.6.78 → 2.6.80
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/README.md +6 -4
- package/dist/zip-fs-full.js +73 -34
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +73 -34
- package/dist/zip-fs.min.js +1 -1
- package/index.cjs +73 -34
- package/index.d.ts +22 -15
- package/lib/core/zip-fs-core.js +76 -34
- package/package.json +1 -1
package/dist/zip-fs.js
CHANGED
|
@@ -4876,6 +4876,7 @@
|
|
|
4876
4876
|
fs,
|
|
4877
4877
|
name,
|
|
4878
4878
|
data: params.data,
|
|
4879
|
+
options: params.options,
|
|
4879
4880
|
id: fs.entries.length,
|
|
4880
4881
|
parent,
|
|
4881
4882
|
children: [],
|
|
@@ -5042,39 +5043,43 @@
|
|
|
5042
5043
|
return clonedEntry;
|
|
5043
5044
|
}
|
|
5044
5045
|
|
|
5045
|
-
addDirectory(name) {
|
|
5046
|
-
return addChild(this, name,
|
|
5046
|
+
addDirectory(name, options) {
|
|
5047
|
+
return addChild(this, name, { options }, true);
|
|
5047
5048
|
}
|
|
5048
5049
|
|
|
5049
|
-
addText(name, text) {
|
|
5050
|
+
addText(name, text, options = {}) {
|
|
5050
5051
|
return addChild(this, name, {
|
|
5051
5052
|
data: text,
|
|
5052
5053
|
Reader: TextReader,
|
|
5053
|
-
Writer: TextWriter
|
|
5054
|
+
Writer: TextWriter,
|
|
5055
|
+
options
|
|
5054
5056
|
});
|
|
5055
5057
|
}
|
|
5056
5058
|
|
|
5057
|
-
addBlob(name, blob) {
|
|
5059
|
+
addBlob(name, blob, options = {}) {
|
|
5058
5060
|
return addChild(this, name, {
|
|
5059
5061
|
data: blob,
|
|
5060
5062
|
Reader: BlobReader,
|
|
5061
|
-
Writer: BlobWriter
|
|
5063
|
+
Writer: BlobWriter,
|
|
5064
|
+
options
|
|
5062
5065
|
});
|
|
5063
5066
|
}
|
|
5064
5067
|
|
|
5065
|
-
addData64URI(name, dataURI) {
|
|
5068
|
+
addData64URI(name, dataURI, options = {}) {
|
|
5066
5069
|
return addChild(this, name, {
|
|
5067
5070
|
data: dataURI,
|
|
5068
5071
|
Reader: Data64URIReader,
|
|
5069
|
-
Writer: Data64URIWriter
|
|
5072
|
+
Writer: Data64URIWriter,
|
|
5073
|
+
options
|
|
5070
5074
|
});
|
|
5071
5075
|
}
|
|
5072
5076
|
|
|
5073
|
-
addUint8Array(name, array) {
|
|
5077
|
+
addUint8Array(name, array, options = {}) {
|
|
5074
5078
|
return addChild(this, name, {
|
|
5075
5079
|
data: array,
|
|
5076
5080
|
Reader: Uint8ArrayReader,
|
|
5077
|
-
Writer: Uint8ArrayWriter
|
|
5081
|
+
Writer: Uint8ArrayWriter,
|
|
5082
|
+
options
|
|
5078
5083
|
});
|
|
5079
5084
|
}
|
|
5080
5085
|
|
|
@@ -5085,18 +5090,20 @@
|
|
|
5085
5090
|
constructor(url) {
|
|
5086
5091
|
super(url, options);
|
|
5087
5092
|
}
|
|
5088
|
-
}
|
|
5093
|
+
},
|
|
5094
|
+
options
|
|
5089
5095
|
});
|
|
5090
5096
|
}
|
|
5091
5097
|
|
|
5092
|
-
addReadable(name, readable) {
|
|
5098
|
+
addReadable(name, readable, options = {}) {
|
|
5093
5099
|
return addChild(this, name, {
|
|
5094
|
-
Reader: function () { return { readable }; }
|
|
5100
|
+
Reader: function () { return { readable }; },
|
|
5101
|
+
options
|
|
5095
5102
|
});
|
|
5096
5103
|
}
|
|
5097
5104
|
|
|
5098
|
-
addFileSystemEntry(fileSystemEntry) {
|
|
5099
|
-
return addFileSystemEntry(this, fileSystemEntry);
|
|
5105
|
+
addFileSystemEntry(fileSystemEntry, options = {}) {
|
|
5106
|
+
return addFileSystemEntry(this, fileSystemEntry, options);
|
|
5100
5107
|
}
|
|
5101
5108
|
|
|
5102
5109
|
addData(name, params) {
|
|
@@ -5234,32 +5241,32 @@
|
|
|
5234
5241
|
return this.root.getChildByName(name);
|
|
5235
5242
|
}
|
|
5236
5243
|
|
|
5237
|
-
addDirectory(name) {
|
|
5238
|
-
return this.root.addDirectory(name);
|
|
5244
|
+
addDirectory(name, options) {
|
|
5245
|
+
return this.root.addDirectory(name, options);
|
|
5239
5246
|
}
|
|
5240
5247
|
|
|
5241
|
-
addText(name, text) {
|
|
5242
|
-
return this.root.addText(name, text);
|
|
5248
|
+
addText(name, text, options) {
|
|
5249
|
+
return this.root.addText(name, text, options);
|
|
5243
5250
|
}
|
|
5244
5251
|
|
|
5245
|
-
addBlob(name, blob) {
|
|
5246
|
-
return this.root.addBlob(name, blob);
|
|
5252
|
+
addBlob(name, blob, options) {
|
|
5253
|
+
return this.root.addBlob(name, blob, options);
|
|
5247
5254
|
}
|
|
5248
5255
|
|
|
5249
|
-
addData64URI(name, dataURI) {
|
|
5250
|
-
return this.root.addData64URI(name, dataURI);
|
|
5256
|
+
addData64URI(name, dataURI, options) {
|
|
5257
|
+
return this.root.addData64URI(name, dataURI, options);
|
|
5251
5258
|
}
|
|
5252
5259
|
|
|
5253
5260
|
addHttpContent(name, url, options) {
|
|
5254
5261
|
return this.root.addHttpContent(name, url, options);
|
|
5255
5262
|
}
|
|
5256
5263
|
|
|
5257
|
-
addReadable(name, readable) {
|
|
5258
|
-
return this.root.addReadable(name, readable);
|
|
5264
|
+
addReadable(name, readable, options) {
|
|
5265
|
+
return this.root.addReadable(name, readable, options);
|
|
5259
5266
|
}
|
|
5260
5267
|
|
|
5261
|
-
addFileSystemEntry(fileSystemEntry) {
|
|
5262
|
-
return this.root.addFileSystemEntry(fileSystemEntry);
|
|
5268
|
+
addFileSystemEntry(fileSystemEntry, options) {
|
|
5269
|
+
return this.root.addFileSystemEntry(fileSystemEntry, options);
|
|
5263
5270
|
}
|
|
5264
5271
|
|
|
5265
5272
|
addData(name, params) {
|
|
@@ -5354,7 +5361,16 @@
|
|
|
5354
5361
|
await initReaders(child, options);
|
|
5355
5362
|
} else {
|
|
5356
5363
|
const reader = child.reader = new child.Reader(child.data, options);
|
|
5357
|
-
|
|
5364
|
+
try {
|
|
5365
|
+
await initStream(reader);
|
|
5366
|
+
} catch (error) {
|
|
5367
|
+
try {
|
|
5368
|
+
error.entryId = child.id;
|
|
5369
|
+
} catch (_error) {
|
|
5370
|
+
// ignored
|
|
5371
|
+
}
|
|
5372
|
+
throw error;
|
|
5373
|
+
}
|
|
5358
5374
|
child.uncompressedSize = reader.size;
|
|
5359
5375
|
}
|
|
5360
5376
|
}));
|
|
@@ -5392,9 +5408,32 @@
|
|
|
5392
5408
|
|
|
5393
5409
|
async function processChild(child) {
|
|
5394
5410
|
const name = options.relativePath ? child.getRelativeName(selectedEntry) : child.getFullname();
|
|
5411
|
+
let externalFileAttribute;
|
|
5412
|
+
let versionMadeBy;
|
|
5413
|
+
let comment;
|
|
5414
|
+
let lastModDate;
|
|
5415
|
+
let lastAccessDate;
|
|
5416
|
+
let creationDate;
|
|
5417
|
+
let childOptions = child.options || {};
|
|
5418
|
+
if (child.data instanceof Entry) {
|
|
5419
|
+
({
|
|
5420
|
+
externalFileAttribute,
|
|
5421
|
+
versionMadeBy,
|
|
5422
|
+
comment,
|
|
5423
|
+
lastModDate,
|
|
5424
|
+
lastAccessDate,
|
|
5425
|
+
creationDate
|
|
5426
|
+
} = child.data);
|
|
5427
|
+
}
|
|
5395
5428
|
await zipWriter.add(name, child.reader, Object.assign({
|
|
5396
5429
|
directory: child.directory
|
|
5397
5430
|
}, Object.assign({}, options, {
|
|
5431
|
+
externalFileAttribute,
|
|
5432
|
+
versionMadeBy,
|
|
5433
|
+
comment,
|
|
5434
|
+
lastModDate,
|
|
5435
|
+
lastAccessDate,
|
|
5436
|
+
creationDate,
|
|
5398
5437
|
onprogress: async indexProgress => {
|
|
5399
5438
|
if (options.onprogress) {
|
|
5400
5439
|
entryOffsets.set(name, indexProgress);
|
|
@@ -5405,30 +5444,30 @@
|
|
|
5405
5444
|
}
|
|
5406
5445
|
}
|
|
5407
5446
|
}
|
|
5408
|
-
})));
|
|
5447
|
+
}, childOptions)));
|
|
5409
5448
|
await process(zipWriter, child);
|
|
5410
5449
|
}
|
|
5411
5450
|
}
|
|
5412
5451
|
}
|
|
5413
5452
|
|
|
5414
|
-
async function addFileSystemEntry(zipEntry, fileSystemEntry) {
|
|
5453
|
+
async function addFileSystemEntry(zipEntry, fileSystemEntry, options) {
|
|
5415
5454
|
if (fileSystemEntry.isDirectory) {
|
|
5416
|
-
const entry = zipEntry.addDirectory(fileSystemEntry.name);
|
|
5455
|
+
const entry = zipEntry.addDirectory(fileSystemEntry.name, options);
|
|
5417
5456
|
await addDirectory(entry, fileSystemEntry);
|
|
5418
5457
|
return entry;
|
|
5419
5458
|
} else {
|
|
5420
|
-
return new Promise((resolve, reject) => fileSystemEntry.file(file => resolve(zipEntry.addBlob(fileSystemEntry.name, file)), reject));
|
|
5459
|
+
return new Promise((resolve, reject) => fileSystemEntry.file(file => resolve(zipEntry.addBlob(fileSystemEntry.name, file, options)), reject));
|
|
5421
5460
|
}
|
|
5422
5461
|
|
|
5423
5462
|
async function addDirectory(zipEntry, fileEntry) {
|
|
5424
5463
|
const children = await getChildren(fileEntry);
|
|
5425
5464
|
for (const child of children) {
|
|
5426
5465
|
if (child.isDirectory) {
|
|
5427
|
-
await addDirectory(zipEntry.addDirectory(child.name), child);
|
|
5466
|
+
await addDirectory(zipEntry.addDirectory(child.name, options), child);
|
|
5428
5467
|
} else {
|
|
5429
5468
|
await new Promise((resolve, reject) => {
|
|
5430
5469
|
child.file(file => {
|
|
5431
|
-
const childZipEntry = zipEntry.addBlob(child.name, file);
|
|
5470
|
+
const childZipEntry = zipEntry.addBlob(child.name, file, options);
|
|
5432
5471
|
childZipEntry.uncompressedSize = file.size;
|
|
5433
5472
|
resolve(childZipEntry);
|
|
5434
5473
|
}, reject);
|