Skip to content
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

Bun.inflateSync() can't decompresses buffer by new CompressionStream('deflate') #6659

Open
truongan07 opened this issue Oct 22, 2023 · 2 comments
Labels
enhancement New feature or request web-api Something that relates to a standard Web API

Comments

@truongan07
Copy link

What version of Bun is running?

1.0.6+969da088f5db3258a803ec186012e30f992829b4

What platform is your computer?

Linux 6.3.6-arch1-1 x86_64 unknown

What steps can reproduce the bug?

  • on browser :
(async () => {
  const compression = async item => {
    const compression = new CompressionStream('deflate'), writer = compression.writable.getWriter();
    
      writer.write(item);
      writer.close();
      
      return await new Response(compression.readable).arrayBuffer();
    };

  const decompression = async compress => {
    const decompression = new DecompressionStream('deflate'), writer = decompression.writable.getWriter();
  
      writer.write(compress);
      writer.close();
      
      return await new Response(decompression.readable).arrayBuffer();
  };
	
  const text = 'this is text';
  const encoder = new TextEncoder;
  const compress = await compression(encoder.encode(text));
  
  console.log('compress = ', compress);
  
  const decompress = await decompression(compress);
  const decoder = new TextDecoder;
  
  console.log('decompress = ', decompress);
  console.log('text = ', decoder.decode(decompress));
  
  // error
  console.log('error = ', decoder.decode(compress)); 	
})();
  • with Bun.inflateSync() on server : compress buffer on browser and send compressed buffer to server to decompress by Bun.inflateSync(). i get error: invalid stored block lengths

What is the expected behavior?

i want Bun.inflateSync() method can decompress as DecompressionStream

What do you see instead?

No response

Additional information

No response

@truongan07 truongan07 added the bug Something isn't working label Oct 22, 2023
@Electroid
Copy link
Contributor

Bun does not support CompressionStream yet.

@Electroid Electroid added web-api Something that relates to a standard Web API enhancement New feature or request and removed bug Something isn't working labels Oct 23, 2023
@danielniccoli
Copy link

It's on the roadmap #159

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request web-api Something that relates to a standard Web API
Projects
None yet
Development

No branches or pull requests

3 participants