-
-
Notifications
You must be signed in to change notification settings - Fork 34.7k
zlib: add support for brotli compression dictionary #61763
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
base: main
Are you sure you want to change the base?
Conversation
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
addaleax
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nice!
| void Close(); | ||
| void DoThreadPoolWork(); | ||
| CompressionError Init(); | ||
| CompressionError Init(std::string_view dictionary = {}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This didn't feel important enough to request an update, but since the linter is failing anyway – if this were
| CompressionError Init(std::string_view dictionary = {}); | |
| CompressionError Init(std::vector<uint8_t>&& dictionary = {}); |
the ownership semantics would be a bit clearer (i.e. it becomes obvious that this class will take ownership of the argument, instead of the std::string_view case where that's less clear)
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #61763 +/- ##
==========================================
- Coverage 89.74% 89.72% -0.02%
==========================================
Files 675 675
Lines 204642 204690 +48
Branches 39322 39330 +8
==========================================
+ Hits 183657 183668 +11
- Misses 13257 13289 +32
- Partials 7728 7733 +5
🚀 New features to boost your workflow:
|
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