-
Notifications
You must be signed in to change notification settings - Fork 63
Description
Hi, I'm developing a streaming .ZIP library that uses miniz_oxide for decompressing DEFLATE. Streaming is hard because you get the data in smaller chunks and want to decompress incrementally. Because of some peculiarities of the .ZIP format, you don't sometimes even know the size of the data beforehands. Here's my library (WIP): https://github.com/golddranks/stream_zipper
I've managed to get decompression to work when parsing files as one chunk. However, incremental decompression is giving me trouble. I'd like to ask some questions which I'd hope get eventually clarified in documentation:
-
What's the difference between
FailedCannotMakeProgress
andNeedsMoreInput
states? If I handminiz_oxide
a partial buffer (trygit cloning
my repo and runningcargo test test_partial_decompression -- --nocapture
and see the debug printing; it gives 400 bytes instead of the full buffer), I getFailedCannotMakeProgress
. -
If I want to continue incrementally, what parameters am I supposed to pass? At the moment, I pass the rest of the input buffer (bytes after 400 EDIT: After making sure that it has indeed consumed 400 bytes up to that point!) and make a fresh output buffer, plus reuse the same
DecompressorOxide
struct, but it returns aFailure
. If I pass the input buffer in one go, it manages to decompress the thing. (Edit: Is it already in a failed state afterFailedCannotMakeProgress
so that's why it returnsFailure
?) -
If I understand right, DEFLATE stream format has a marker when the stream ends, so knowing the size beforehands isn't required. Is this correct?