-
Notifications
You must be signed in to change notification settings - Fork 34
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
Zlib: add stream-oriented operations #212
base: master
Are you sure you want to change the base?
Conversation
1249ed8
to
5ba94d1
Compare
On a first glance this looks good. Not overly happy with the constructor naming, "infnew" and "defnew" reminds me on infinity and default, not inflate and deflate for some reason. What about calling the constructors
|
Ok, I'll go with the former to keep things short.
Won't that be confusing with the same-name functions ?
I suppose you have a point. My initial idea was to have the stream functions default to the same behavior as the single-call oriented ones, and force the user to select a flush mode, but it's probably not ideal now that I think about it. Will switch to Z_NO_FLUSH instead.
Sorry no can do. I don't have npm on my system and no intention of installing it just for this use given how it's been a proven attack vector multiple times already. Sorry. I'll fix the
Actually the example is clumsy (I was lazy there). In real life you would of course use Z_FINISH with the last sent chunk, not with an empty one. The latter works and completes the stream to a valid archive but adds an unnecessary extra block. I'll improve the doc. |
No, that string literal for the resource type is just used to uniquely identify the resource type within the global VM context, it does not share the namespace with variables. The name is also used when converting resource values to strings, e.g. for printing. A deflate stream will appear as something like
|
a694e92
to
20a1fed
Compare
Prepare for stream-oriented operations Signed-off-by: Thibaut VARÈNE <[email protected]>
No functional change Signed-off-by: Thibaut VARÈNE <[email protected]>
Signed-off-by: Thibaut VARÈNE <[email protected]>
Signed-off-by: Thibaut VARÈNE <[email protected]>
@jow- friendly ping, is there anything else you wanted changed here? :) |
This PR introduces stream-oriented primitives for dealing with zlib data.
The code is split into functional commits for easier review.
Memory pressure is directly dependent on how often the stream output buffer is flushed through
read()
calls, so this implementation makes it possible to continuously compress data within a memory cap.Notes:
*new()
naming suffix for the stream constructorOnly happy testing has been performed (successfully) so far, comments welcome
HTH