Skip to content

zlib: add support for brotli compression dictionary#61763

Open
rokob wants to merge 3 commits intonodejs:mainfrom
rokob:aw-52250-brotli-dict
Open

zlib: add support for brotli compression dictionary#61763
rokob wants to merge 3 commits intonodejs:mainfrom
rokob:aw-52250-brotli-dict

Conversation

@rokob
Copy link

@rokob rokob commented Feb 10, 2026

This change adds JS API support for custom compression dictionaries with Brotli in the zlib library. The underlying Brotli dependency already supports this and zstd exposes something similar. This follows the zstd approach for using a custom dictionary but for Brotli.

Fixes: #52250

Notes

I wanted to get the change up here first to get feedback and ensure the API makes sense. I can then update any relevant docs. The tests

This change adds JS API support for custom compression dictionaries
with Brotli in the zlib library. The underlying Brotli dependency
already supports this and zstd exposes something similar.
This follows the zstd approach for using a custom dictionary but
for Brotli.

Fixes: nodejs#52250
@nodejs-github-bot nodejs-github-bot added c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib subsystem. labels Feb 10, 2026
Copy link
Member

@addaleax addaleax left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nice!

@addaleax addaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Feb 11, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 11, 2026
@nodejs-github-bot
Copy link
Collaborator

@addaleax addaleax removed the author ready PRs that have at least one approval, no pending requests for changes, and a CI started. label Feb 11, 2026
@codecov
Copy link

codecov bot commented Feb 11, 2026

Codecov Report

❌ Patch coverage is 80.64516% with 12 lines in your changes missing coverage. Please review.
βœ… Project coverage is 89.74%. Comparing base (3819c7f) to head (f733e95).
⚠️ Report is 21 commits behind head on main.

Files with missing lines Patch % Lines
src/node_zlib.cc 72.09% 6 Missing and 6 partials ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main   #61763   +/-   ##
=======================================
  Coverage   89.74%   89.74%           
=======================================
  Files         675      675           
  Lines      204642   204729   +87     
  Branches    39322    39333   +11     
=======================================
+ Hits       183657   183744   +87     
+ Misses      13257    13253    -4     
- Partials     7728     7732    +4     
Files with missing lines Coverage Ξ”
lib/zlib.js 98.30% <100.00%> (+0.02%) ⬆️
src/node_zlib.cc 77.79% <72.09%> (-0.27%) ⬇️

... and 42 files with indirect coverage changes

πŸš€ New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • πŸ“¦ JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@rokob
Copy link
Author

rokob commented Feb 11, 2026

I updated the initializer to use an r-value ref and added some argument validation on the js side along with some tests. Linters all pass locally for me.

@addaleax addaleax added request-ci Add this label to start a Jenkins CI on a PR. and removed request-ci Add this label to start a Jenkins CI on a PR. labels Feb 12, 2026
@rokob
Copy link
Author

rokob commented Feb 12, 2026

I ran make format-cpp locally which passed which I realized looking at the actions was not setting the CLANG_FORMAT_START variable correctly. I set that locally which captured the issues that showed up in CI and fixed those. My bad.

@addaleax addaleax added author ready PRs that have at least one approval, no pending requests for changes, and a CI started. request-ci Add this label to start a Jenkins CI on a PR. labels Feb 12, 2026
@github-actions github-actions bot removed the request-ci Add this label to start a Jenkins CI on a PR. label Feb 12, 2026
@nodejs-github-bot
Copy link
Collaborator

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

author ready PRs that have at least one approval, no pending requests for changes, and a CI started. c++ Issues and PRs that require attention from people who are familiar with C++. needs-ci PRs that need a full CI run. zlib Issues and PRs related to the zlib subsystem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Please add latest brotli 1.1.0 bindings with compression dictionary support

5 participants