You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
What can't you do right now?
I'm trying to process a buffer with sections that are compressed with deflate. I know where these sections start, but have no idea how long they are. I need to skip past these sections so I can continue processing the buffer.
If there were a way to know at which offset EOF happened I would be able to skip past these sections.
Example Buffer:
| plaintext data I want to read | deflated data of unknown length | plaintext data I want to read |
An optimal solution
Two possibilities:
The "Unexpected EOF" error reports the offset at which the file ended.
The inflate command succeeds with the decompressed data and tells you how many bytes remained unprocessed in the input.
How is this done by other libraries? pako (which I'm currently using) doesn't fail when hitting the EOF. Instead it emits the decompressed data & has a value you can read the tells you how many bytes have remained unprocessed.
Eg. If you have a 150byte buffer and the first 100 are deflated-data, it will emit the decompressed data & tell you there are 50 bytes remaining.
The text was updated successfully, but these errors were encountered:
The last time I tried something like this fflate just decompresses up to the end of the DEFLATE stream and no further, meaning it wouldn't provide an EOF error at all. I might be mistaken or maybe you're doing something differently than I'm imagining - could you send a code snippet I can use to reproduce the EOF error?
Regardless, you are right that there isn't a way to figure out how many compressed bytes have been read after decompression completes. This should be addressable in the streaming API without much difficulty, but it will not be added to the standard buffer-based API (to keep that API simple and bloat-free). Will look into it for the next release.
What can't you do right now?
I'm trying to process a buffer with sections that are compressed with deflate. I know where these sections start, but have no idea how long they are. I need to skip past these sections so I can continue processing the buffer.
If there were a way to know at which offset EOF happened I would be able to skip past these sections.
Example Buffer:
An optimal solution
Two possibilities:
inflate
command succeeds with the decompressed data and tells you how many bytes remained unprocessed in the input.How is this done by other libraries?
pako
(which I'm currently using) doesn't fail when hitting the EOF. Instead it emits the decompressed data & has a value you can read the tells you how many bytes have remained unprocessed.Eg. If you have a 150byte buffer and the first 100 are deflated-data, it will emit the decompressed data & tell you there are 50 bytes remaining.
The text was updated successfully, but these errors were encountered: