Skip to content

Commit

Permalink
pass options to Reader instances
Browse files Browse the repository at this point in the history
  • Loading branch information
gildas-lormeau committed Mar 8, 2023
1 parent 7b0cd10 commit b66e675
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions lib/core/zip-fs-core.js
Original file line number Diff line number Diff line change
Expand Up @@ -347,7 +347,7 @@ class ZipDirectoryEntry extends ZipEntry {

async exportZip(writer, options) {
const zipEntry = this;
await Promise.all([initReaders(zipEntry), initStream(writer)]);
await Promise.all([initReaders(zipEntry, options), initStream(writer)]);
const zipWriter = new ZipWriter(writer, options);
await exportZip(zipWriter, zipEntry, getTotalSize([zipEntry], "uncompressedSize"), options);
await zipWriter.close();
Expand Down Expand Up @@ -535,13 +535,15 @@ function getZipBlobReader(options) {
};
}

async function initReaders(entry) {
async function initReaders(entry, options) {
if (entry.children.length) {
await Promise.all(entry.children.map(async child => {
if (child.directory) {
await initReaders(child);
const readerOptions = Object.assign({}, options);
readerOptions.onprogress = null;
await initReaders(child, readerOptions);
} else {
const reader = child.reader = new child.Reader(child.data);
const reader = child.reader = new child.Reader(child.data, options);
await initStream(reader);
child.uncompressedSize = reader.size;
}
Expand Down

0 comments on commit b66e675

Please sign in to comment.