fix(ext/node): add zstd compression support to node:zlib#32025
Merged
bartlomieju merged 10 commits intodenoland:mainfrom Feb 3, 2026
Merged
fix(ext/node): add zstd compression support to node:zlib#32025bartlomieju merged 10 commits intodenoland:mainfrom
bartlomieju merged 10 commits intodenoland:mainfrom
Conversation
Implements Zstandard (zstd) compression and decompression support for the Node.js compatibility layer. This adds ZstdCompress and ZstdDecompress classes that work with Node's streaming zlib API. - Add zstd dependency to ext/node - Implement ZstdCompress and ZstdDecompress in Rust using zstd crate - Export bindings via _zlib_binding.mjs - Add ZSTD constants to internal_binding/constants.ts - Update zlib.js to pass mode parameter to constructors 4 of 7 zstd tests now pass (flush, from-string, dictionary, from-zstd). Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
- Add ERR_ZSTD_INVALID_PARAM error class for invalid zstd parameters - Make ERR_ZLIB_INITIALIZATION_FAILED accept custom message - Validate zstd strategy values and return error on invalid params - Check set_parameter return values and fail on error 5 of 7 zstd tests now pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2306c2a to
58cf75a
Compare
- Add pledgedSrcSize parameter to ZstdCompress::init - Set error code ZSTD_error_srcSize_wrong for size mismatch errors - Catch errors in processChunk and emit via destroy() properly - Add ERR_ZLIB_INITIALIZATION_FAILED to error codes 6 of 7 zstd tests now pass. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
58cf75a to
ebbc57d
Compare
Properly implement deprecateInstantiation to create and return a new instance when zlib classes are called without `new`. This allows proper error handling for invalid arguments. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
littledivy
requested changes
Feb 3, 2026
Comment on lines
+1354
to
+1356
| // SAFETY: `write_result` is a valid pointer to a mutable slice of u32 of length 2. | ||
| unsafe { | ||
| let result = std::slice::from_raw_parts_mut(ctx.write_result, 2); |
Member
There was a problem hiding this comment.
This doesn't check anywhere that length of write_result is infact not less than 2
littledivy
approved these changes
Feb 3, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This commit improves impl of
node:zlibmodule by adding zstd compression support.Several Node compat tests were enabled, more will be enabled in a follow up.
🤖 Generated with Claude Code