Note: This feature is available in Web Workers.
The CompressionStream
interface of the Compression Streams API is an API for compressing a stream of data.
Since May 2023, this feature works across the latest devices and browser versions. This feature might not work in older devices or browsers.
Note: This feature is available in Web Workers.
The CompressionStream
interface of the Compression Streams API is an API for compressing a stream of data.
CompressionStream()
Creates a new CompressionStream
CompressionStream.readable
Returns the ReadableStream
instance controlled by this object.
CompressionStream.writable
Returns the WritableStream
instance controlled by this object.
In this example a stream is compressed using gzip compression.
const compressedReadableStream = inputReadableStream.pipeThrough( new CompressionStream("gzip"), );
Specification |
---|
Compression Standard # compression-stream |
Desktop | Mobile | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
Chrome | Edge | Firefox | Opera | Safari | Chrome Android | Firefox for Android | Opera Android | Safari on IOS | Samsung Internet | WebView Android | ||
CompressionStream |
80 | 80 | 113 | 67 | 16.4 | 80 | 113 | 57 | 16.4 | 13.0 | 80 | |
CompressionStream |
80 | 80 | 113 | 67 | 16.4 | 80 | 113 | 57 | 16.4 | 13.0 | 80 | |
readable |
80 | 80 | 113 | 67 | 16.4 | 80 | 113 | 57 | 16.4 | 13.0 | 80 | |
writable |
80 | 80 | 113 | 67 | 16.4 | 80 | 113 | 57 | 16.4 | 13.0 | 80 |
© 2005–2023 MDN contributors.
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-US/docs/Web/API/CompressionStream