`CompressionStream` & `DecompressionStream` types don't support brotli & zstd
What version of Bun is running?
1.3.3+274e01c73
What platform is your computer?
Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64
What steps can reproduce the bug?
simple example from the 1.3.3 blog post detailing CompressionStream implementation:
async function main() {
const response = await fetch("https://example.com");
const zstd = response.body!.pipeThrough(new CompressionStream("zstd"));
}
What is the expected behavior?
types for CompressionStream and DecompressionStream should have brotli and zstd added
What do you see instead?
type error: Argument of type '"zstd"' is not assignable to parameter of type 'CompressionFormat'.
Additional information
No response
Yeah they aren't officially standard ones. I think it's still possible for bun to add extra "overloads" though.
yep the functionality works fine since it can just be casted to CompressionFormat, it's just a bit strange to require casting or tsignore for an officially supported feature
- I made new the function from CompressionStream / DecompressionStream to easy using
- And this is native CompressionStream / DecompressionStream
- I did not get any errors such as type error: Argument of type '"zstd"' is not assignable to parameter of type 'CompressionFormat'. Maybe it just happens Linux 6.6.87.2-microsoft-standard-WSL2 x86_64 x86_64 ?
yep the functionality works fine since it can just be casted to
CompressionFormat, it's just a bit strange to require casting or tsignore for an officially supported feature
Yoo nice, feel free to make a pr and @alii should review and merge!
https://github.com/oven-sh/bun/pull/25374
admittedly needed claude to guide me but these changes when made in my own project's node_modules seems to work, feel free to just close if it's just slop
Thank you for reporting and opening a pull request! I left a couple notes on the PR :-)
Hi @alii , please support ArrayBuffer (output) for CompressionStream / DecompressionStream