zlib: add sync versions for convenience methods#6987
zlib: add sync versions for convenience methods#6987seishun wants to merge 6 commits intonodejs:masterfrom seishun:sync-zlib
Conversation
|
Thank you for contributing this pull request! Here are a few pointers to make sure your submission will be considered for inclusion. The following commiters were not found in the CLA:
You can fix all these things without opening another issue. Please see CONTRIBUTING.md for more information |
src/node_zlib.cc
Outdated
There was a problem hiding this comment.
Please try to de-dupe it, perhaps a template version of AfterWork could handle it.
|
Generally, looks good to me. But needs documentation fixes too. |
|
Done. |
src/node_zlib.cc
Outdated
There was a problem hiding this comment.
I know you copied from below, but please remove braces { }
|
Yay, almost ready! :) Thank you very much. Please correct last nits and let me know |
|
Done again! |
lib/zlib.js
Outdated
There was a problem hiding this comment.
Sorry, but one more thing. Please move it to separate function as well.
|
Question: Shouldn't we choose one and unify the API accordingly? And as |
|
@thomseddon On the other hand, |
|
@thomseddon I agree with @seishun |
|
@seishun Good point well made :) |
|
Okay I know this is crazy but I couldn't think of a better way to de-dupe this. |
|
What? |
|
I'm not sure I understand the question. I was referring to my last commit. I didn't know how the core devs would feel about the callback approach in de-duping the recursive write but the idea seemed interesting to me so I did it anyway. Also it's 2:30 AM here so I'll probably refrain from writing anything else for today. |
|
Ah, you was referring to your last commit |
lib/zlib.js
Outdated
There was a problem hiding this comment.
Good approach! But let's try to avoid calling apply, where possible.
And additional advice, you could pass true as an argument for async write and false for a synchronous write and call writeSync/write in the _processChunk.
The user should have an option to run CPU-bound functions synchronously. Zlib is the only case where they don't.
This patch should be considered as a draft or a proof-of-concept. Any directions on how it could be improved will be greatly appreciated.