Skip to content

Commit

Permalink
Merge pull request #1 from likev/patch-2
Browse files Browse the repository at this point in the history
Scanning a local file headers is not necessary
  • Loading branch information
likev committed Mar 19, 2023
2 parents ee5f98a + a137863 commit ecfe95b
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zipEntry.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ module.exports = function (/*Buffer*/ input) {
if (!input || !Buffer.isBuffer(input)) {
return Buffer.alloc(0);
}
_entryHeader.loadDataHeaderFromBinary(input);
//Scanning a local file headers is not necessary (except in the case of corrupted archives)
if(!_entryHeader.compressedSize) _entryHeader.loadDataHeaderFromBinary(input);
return input.slice(_entryHeader.realDataOffset, _entryHeader.realDataOffset + _entryHeader.compressedSize);
}

Expand Down

0 comments on commit ecfe95b

Please sign in to comment.