@zip.js/zip.js 2.7.14 → 2.7.15
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/dist/zip-fs-full.js +21 -11
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +21 -11
- package/dist/zip-fs.min.js +1 -1
- package/index.cjs +21 -11
- package/lib/core/zip-fs-core.js +21 -11
- package/package.json +1 -1
package/index.cjs
CHANGED
|
@@ -10131,7 +10131,7 @@ class ZipEntry {
|
|
|
10131
10131
|
id: fs.entries.length,
|
|
10132
10132
|
parent,
|
|
10133
10133
|
children: [],
|
|
10134
|
-
uncompressedSize: 0
|
|
10134
|
+
uncompressedSize: params.uncompressedSize || 0
|
|
10135
10135
|
});
|
|
10136
10136
|
fs.entries.push(zipEntry);
|
|
10137
10137
|
if (parent) {
|
|
@@ -10328,7 +10328,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10328
10328
|
data: text,
|
|
10329
10329
|
Reader: TextReader,
|
|
10330
10330
|
Writer: TextWriter,
|
|
10331
|
-
options
|
|
10331
|
+
options,
|
|
10332
|
+
uncompressedSize: text.length
|
|
10332
10333
|
});
|
|
10333
10334
|
}
|
|
10334
10335
|
|
|
@@ -10337,16 +10338,23 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10337
10338
|
data: blob,
|
|
10338
10339
|
Reader: BlobReader,
|
|
10339
10340
|
Writer: BlobWriter,
|
|
10340
|
-
options
|
|
10341
|
+
options,
|
|
10342
|
+
uncompressedSize: blob.size
|
|
10341
10343
|
});
|
|
10342
10344
|
}
|
|
10343
10345
|
|
|
10344
10346
|
addData64URI(name, dataURI, options = {}) {
|
|
10347
|
+
let dataEnd = dataURI.length;
|
|
10348
|
+
while (dataURI.charAt(dataEnd - 1) == "=") {
|
|
10349
|
+
dataEnd--;
|
|
10350
|
+
}
|
|
10351
|
+
const dataStart = dataURI.indexOf(",") + 1;
|
|
10345
10352
|
return addChild(this, name, {
|
|
10346
10353
|
data: dataURI,
|
|
10347
10354
|
Reader: Data64URIReader,
|
|
10348
10355
|
Writer: Data64URIWriter,
|
|
10349
|
-
options
|
|
10356
|
+
options,
|
|
10357
|
+
uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
|
|
10350
10358
|
});
|
|
10351
10359
|
}
|
|
10352
10360
|
|
|
@@ -10355,7 +10363,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10355
10363
|
data: array,
|
|
10356
10364
|
Reader: Uint8ArrayReader,
|
|
10357
10365
|
Writer: Uint8ArrayWriter,
|
|
10358
|
-
options
|
|
10366
|
+
options,
|
|
10367
|
+
uncompressedSize: array.length
|
|
10359
10368
|
});
|
|
10360
10369
|
}
|
|
10361
10370
|
|
|
@@ -10397,7 +10406,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10397
10406
|
const size = file.size;
|
|
10398
10407
|
return { readable, size };
|
|
10399
10408
|
},
|
|
10400
|
-
options
|
|
10409
|
+
options,
|
|
10410
|
+
uncompressedSize: file.size
|
|
10401
10411
|
});
|
|
10402
10412
|
}
|
|
10403
10413
|
|
|
@@ -10463,7 +10473,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
10463
10473
|
if (!entry.directory) {
|
|
10464
10474
|
importedEntries.push(addChild(parent, name, {
|
|
10465
10475
|
data: entry,
|
|
10466
|
-
Reader: getZipBlobReader(Object.assign({}, options))
|
|
10476
|
+
Reader: getZipBlobReader(Object.assign({}, options)),
|
|
10477
|
+
uncompressedSize: entry.uncompressedSize
|
|
10467
10478
|
}));
|
|
10468
10479
|
}
|
|
10469
10480
|
} catch (error) {
|
|
@@ -10816,10 +10827,9 @@ async function addFileSystemHandle(zipEntry, handle, options) {
|
|
|
10816
10827
|
const size = file.size;
|
|
10817
10828
|
return { readable, size };
|
|
10818
10829
|
},
|
|
10819
|
-
options: {
|
|
10820
|
-
|
|
10821
|
-
|
|
10822
|
-
}, options)
|
|
10830
|
+
options: Object.assign({}, { lastModDate: new Date(file.lastModified) }, options),
|
|
10831
|
+
uncompressedSize: file.size
|
|
10832
|
+
})
|
|
10823
10833
|
);
|
|
10824
10834
|
} else if (handle.kind == "directory") {
|
|
10825
10835
|
const directoryEntry = parentEntry.addDirectory(handle.name);
|
package/lib/core/zip-fs-core.js
CHANGED
|
@@ -71,7 +71,7 @@ class ZipEntry {
|
|
|
71
71
|
id: fs.entries.length,
|
|
72
72
|
parent,
|
|
73
73
|
children: [],
|
|
74
|
-
uncompressedSize: 0
|
|
74
|
+
uncompressedSize: params.uncompressedSize || 0
|
|
75
75
|
});
|
|
76
76
|
fs.entries.push(zipEntry);
|
|
77
77
|
if (parent) {
|
|
@@ -268,7 +268,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
268
268
|
data: text,
|
|
269
269
|
Reader: TextReader,
|
|
270
270
|
Writer: TextWriter,
|
|
271
|
-
options
|
|
271
|
+
options,
|
|
272
|
+
uncompressedSize: text.length
|
|
272
273
|
});
|
|
273
274
|
}
|
|
274
275
|
|
|
@@ -277,16 +278,23 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
277
278
|
data: blob,
|
|
278
279
|
Reader: BlobReader,
|
|
279
280
|
Writer: BlobWriter,
|
|
280
|
-
options
|
|
281
|
+
options,
|
|
282
|
+
uncompressedSize: blob.size
|
|
281
283
|
});
|
|
282
284
|
}
|
|
283
285
|
|
|
284
286
|
addData64URI(name, dataURI, options = {}) {
|
|
287
|
+
let dataEnd = dataURI.length;
|
|
288
|
+
while (dataURI.charAt(dataEnd - 1) == "=") {
|
|
289
|
+
dataEnd--;
|
|
290
|
+
}
|
|
291
|
+
const dataStart = dataURI.indexOf(",") + 1;
|
|
285
292
|
return addChild(this, name, {
|
|
286
293
|
data: dataURI,
|
|
287
294
|
Reader: Data64URIReader,
|
|
288
295
|
Writer: Data64URIWriter,
|
|
289
|
-
options
|
|
296
|
+
options,
|
|
297
|
+
uncompressedSize: Math.floor((dataEnd - dataStart) * 0.75)
|
|
290
298
|
});
|
|
291
299
|
}
|
|
292
300
|
|
|
@@ -295,7 +303,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
295
303
|
data: array,
|
|
296
304
|
Reader: Uint8ArrayReader,
|
|
297
305
|
Writer: Uint8ArrayWriter,
|
|
298
|
-
options
|
|
306
|
+
options,
|
|
307
|
+
uncompressedSize: array.length
|
|
299
308
|
});
|
|
300
309
|
}
|
|
301
310
|
|
|
@@ -337,7 +346,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
337
346
|
const size = file.size;
|
|
338
347
|
return { readable, size };
|
|
339
348
|
},
|
|
340
|
-
options
|
|
349
|
+
options,
|
|
350
|
+
uncompressedSize: file.size
|
|
341
351
|
});
|
|
342
352
|
}
|
|
343
353
|
|
|
@@ -403,7 +413,8 @@ class ZipDirectoryEntry extends ZipEntry {
|
|
|
403
413
|
if (!entry.directory) {
|
|
404
414
|
importedEntries.push(addChild(parent, name, {
|
|
405
415
|
data: entry,
|
|
406
|
-
Reader: getZipBlobReader(Object.assign({}, options))
|
|
416
|
+
Reader: getZipBlobReader(Object.assign({}, options)),
|
|
417
|
+
uncompressedSize: entry.uncompressedSize
|
|
407
418
|
}));
|
|
408
419
|
}
|
|
409
420
|
} catch (error) {
|
|
@@ -757,10 +768,9 @@ async function addFileSystemHandle(zipEntry, handle, options) {
|
|
|
757
768
|
const size = file.size;
|
|
758
769
|
return { readable, size };
|
|
759
770
|
},
|
|
760
|
-
options: {
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
}, options)
|
|
771
|
+
options: Object.assign({}, { lastModDate: new Date(file.lastModified) }, options),
|
|
772
|
+
uncompressedSize: file.size
|
|
773
|
+
})
|
|
764
774
|
);
|
|
765
775
|
} else if (handle.kind == "directory") {
|
|
766
776
|
const directoryEntry = parentEntry.addDirectory(handle.name);
|
package/package.json
CHANGED