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

Missing "zstd" compression in CompressionStream #33971

Closed
truongan07 opened this issue Jun 7, 2024 · 4 comments
Closed

Missing "zstd" compression in CompressionStream #33971

truongan07 opened this issue Jun 7, 2024 · 4 comments
Labels
closed: wontfix Out of scope, too much effort, or working as intended Content:WebAPI Web API docs

Comments

@truongan07
Copy link

MDN URL

https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream/CompressionStream

What specific section or headline is this issue about?

No response

What information was incorrect, unhelpful, or incomplete?

CompressionStream does not support "zstd" compression

What did you expect to see?

const compression = new CompressionStream("zstd");
const decompression = new DecompressionStream("zstd")

Do you have any supporting links, references, or citations?

No response

Do you have anything more you want to share?

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

  const decompression = async compress => {
    const decompression = new DecompressionStream('zstd'), 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));
@truongan07 truongan07 added the needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. label Jun 7, 2024
@github-actions github-actions bot added the Content:WebAPI Web API docs label Jun 7, 2024
@hamishwillee
Copy link
Collaborator

Thanks, but I am closing as invalid. This format isn't expected to be supported in the spec - it isn't a valid compression option, and isn't documented as being supported.

@Josh-Cena
Copy link
Member

This is not part of the spec. If you want to see it supported, send the issue to the spec instead.

@Josh-Cena Josh-Cena closed this as not planned Won't fix, can't repro, duplicate, stale Jun 7, 2024
@Josh-Cena Josh-Cena added closed: wontfix Out of scope, too much effort, or working as intended and removed needs triage Triage needed by staff and/or partners. Automatically applied when an issue is opened. labels Jun 7, 2024
@truongan07
Copy link
Author

it isn't a valid compression option ?

image

@Josh-Cena
Copy link
Member

@truongan07 That's what the browser supports. What this particular API supports is specified by https://compression.spec.whatwg.org/#compression-stream

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed: wontfix Out of scope, too much effort, or working as intended Content:WebAPI Web API docs
Projects
None yet
Development

No branches or pull requests

3 participants