brotli compression c# and JS #444

Closed
opened 2026-01-29 20:44:00 +00:00 by claunia · 2 comments
Owner

Originally created by @sasankjonna on GitHub (Jan 10, 2023).

I am using below code to compress using C#
var bytes = Encoding.UTF8.GetBytes(value);
await using var input = new MemoryStream(bytes);
await using var output = new MemoryStream();
await using var stream = new BrotliStream(output, level);

and the below code to compress using JS
zlib.brotliCompress(JSON.stringify(json), {
level : 0,
params: {
[zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT
}
}

The outputs of these two compressions doesnt match. What needs to be tweaked t make them match?

Originally created by @sasankjonna on GitHub (Jan 10, 2023). I am using below code to compress using C# var bytes = Encoding.UTF8.GetBytes(value); await using var input = new MemoryStream(bytes); await using var output = new MemoryStream(); await using var stream = new BrotliStream(output, level); and the below code to compress using JS zlib.brotliCompress(JSON.stringify(json), { level : 0, params: { [zlib.constants.BROTLI_PARAM_MODE]: zlib.constants.BROTLI_MODE_TEXT } } The outputs of these two compressions doesnt match. What needs to be tweaked t make them match?
Author
Owner

@eustas commented on GitHub (Jun 20, 2023):

What are the libraries / versions you use in C# and JS?

@eustas commented on GitHub (Jun 20, 2023): What are the libraries / versions you use in C# and JS?
Author
Owner

@eustas commented on GitHub (Jul 10, 2023):

Feel free to reopen

@eustas commented on GitHub (Jul 10, 2023): Feel free to reopen
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/brotli#444