Description
This issue has been moved from a ticket on Developer Community.
The current implementation of Brotli compression in .NET Core (System.IO.Compression.BrotliEncoder
) lacks support for using shared dictionaries during compression and decompression.
This feature is essential for scenarios where creating compressed diff files based on a shared dictionary (derived from another file) is necessary.
A key scenario, for example, is when using Compression Dictionary Transport feature (new browser feature) it is required to create brotli diff files (dcb) that can be sent to the client instead of the full compressed file payload. This helps reducing download time and therefore improve application performance.
Without this, the alternative for engineer to achieve that is to wrap the brotli cli tool or build a native DLL and creating binding to it from .Net code. Both a complex and have multiple downsides.
Possible API extension could be similar to the BrotliEncoder.Compress
API definition:
BrotliEncoder.CompressWithDictionary (source, desination, dicitonary, ...)
Looking at the implementation of BrotliEncoder.cs
it is unclear to me whether the native library that is used with interop supports shared dictionaries, so if not it needs to be updated to the latest brotli implementation (brotli 1.1.0).
More digging reveals that the native brotli linked code is recent and has the necessary support for shared dictionary. See for example BrotliEncoderPrepareDictionary.
Original Comments
Feedback Bot on 2/4/2025, 01:11 AM:
We have directed your feedback to the appropriate engineering team for further evaluation. The team will review the feedback and notify you about the next steps.