Skip to content

Commit

Permalink
zip-browser return entries length
Browse files Browse the repository at this point in the history
  • Loading branch information
faluelv committed Sep 22, 2016
1 parent 235dfdb commit d6e6430
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions zip-browser.js
Expand Up @@ -56,15 +56,15 @@ Unzip.prototype.getBuffer = function(whatYouNeed, options, callback) {
});

iterator(matchedEntries, options, function(error, bufferArray) {
callback(error, bufferArray);
callback(error, bufferArray, entries.length);
});
});
};

Unzip.prototype.getEntries = function(callback) {
zip.createReader(new zip.BlobReader(this.file), function(zipReader) {
zipReader.getEntries(function(entries) {
callback(null, entries);
callback(null, entries, entries.length);
});
});
};
Expand All @@ -75,7 +75,7 @@ Unzip.getEntryData = function(entry, callback) {
var writer = new zip.BlobWriter();

entry.getData(writer, function(blob) {
callback(null, blob);
callback(null, blob, entry.length);
});
};

Expand All @@ -92,7 +92,7 @@ function iterator(entries, options, callback) {
}

if (!serialize.length) {
callback(null, {});
callback(null, {}, serialize.length);
}

serialize.forEach(function(entryInfo) {
Expand All @@ -103,7 +103,7 @@ function iterator(entries, options, callback) {
if (options.type === 'blob') {
add(name, blob);
if (index >= serialize.length) {
callback(null, output);
callback(null, output, serialize.length);
}
} else {
blobToBuffer(blob, function(error, buffer) {
Expand All @@ -114,7 +114,7 @@ function iterator(entries, options, callback) {
add(name, buffer);

if (index >= serialize.length) {
callback(null, output);
callback(null, output, serialize.length);
}
});
}
Expand Down

0 comments on commit d6e6430

Please sign in to comment.