-
-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use streaming decompress to identify extent of compressed data. (#66)
This fixes a problem that arises for local files with bit 3 of the general purpose bit flag set. In this case, we don't get information up front about the size of the compressed data. So how do we know where the compressed data ends? Previously, we tried to determine this by looking for the signature of the data descriptor. But the data descriptor doesn't always HAVE a signature, and it is also possible for signatures to occur accidentally in the compressed data itself (#65). Here we follow a clue from an Info-ZIP note: "In general, this feature can only be reliably used together with compression methods that allow intrinsic detection of the 'end-of-compressed-data' condition." We use the streaming decompression interface from zlib's Internal module. This tells us, in effect, where the compressed data ends. A parameter has been added to getCompressedData for the compressionMethod, since we only want to do streaming decompression if the data is compressed with Deflate. Closes #65.
- Loading branch information
Showing
1 changed file
with
71 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters