1. Web
  2. Web APIs
  3. CompressionStream

CompressionStream

Baseline 2023
Newly available

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.

Constructor

CompressionStream()

Creates a new CompressionStream

Instance properties

CompressionStream.readable

Returns the ReadableStream instance controlled by this object.

CompressionStream.writable

Returns the WritableStream instance controlled by this object.

Examples

In this example a stream is compressed using gzip compression.

js
const compressedReadableStream = inputReadableStream.pipeThrough(
 new CompressionStream("gzip"),
);

Specifications

Specification
Compression
# compression-stream

Browser compatibility

Help improve MDN

Learn how to contribute

This page was last modified on by MDN contributors.

AltStyle によって変換されたページ (->オリジナル) /