@zip.js/zip.js 2.7.13 → 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 +22 -12
- package/dist/zip-fs-full.min.js +1 -1
- package/dist/zip-fs.js +22 -12
- package/dist/zip-fs.min.js +1 -1
- package/dist/zip-full.js +1 -1
- 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 +1 -1
- package/dist/zip.min.js +1 -1
- package/index.cjs +22 -12
- package/lib/core/io.js +1 -1
- package/lib/core/zip-fs-core.js +21 -11
- package/package.json +1 -1
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