-
Notifications
You must be signed in to change notification settings - Fork 50
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Clarifications about streaming support #24
Comments
Hi!
Hope this helps. |
Hi, thanks for the answer. First of all, about 2. indeed, that was an oversight! Silly me. About 1. So, I'm getting this error when handing a partial buffer to the library – even when calling for the first time, so |
Actually I don't quite understand this explanation: "More input data was expected, but the caller indicated that there was more data, so the input stream is likely truncated" How is the caller indicating that there was more data? If the input stream is truncated, how is this different from just |
Ah! I got it finally! One is supposed to pass the |
Yes, it is able to handle input even byte-by-byte. I completely forgot about that. There is a flag |
It seems that we posted at the same time :D I'll see if I can send some documentation PR's later today! |
The first call now always succeeds with The non-partial tests succeeds whereas the partial one fails. Can you say if I'm using the API somehow wrong? |
Output buffer that is given to If the stream is very large it is a good idea to use wrapping buffer to avoid excessive copying. |
Ah, that explains it. Thanks again. |
Yup, we need to do some work on the documentation, the API is quite low-level so it can be a bit difficult to figure it out. It may also be helpful to look at how the library is used by flate2, which wraps miniz_oxide (though the original miniz is used by default) in reader and writer structs as miniz_oxide is originally a rust port of miniz to get rid of the use of c code in flate2. |
flate2 also has problems decompressing a stream using miniz_oxide: rust-lang/flate2-rs#434 I have also opened an issue in this repository: #158 |
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?
The text was updated successfully, but these errors were encountered: