web api interface
CompressionStream
Available in workers
The CompressionStream interface of the Compression Streams API compresses a stream of data. It implements the same shape as a TransformStream, allowing it to be used in pipeThrough() and similar methods.
Constructor
CompressionStream()- : Creates a new
CompressionStream.
- : Creates a new
Instance properties
readable- : Returns the
ReadableStreaminstance controlled by this object.
- : Returns the
writable- : Returns the
WritableStreaminstance controlled by this object.
- : Returns the
Examples
In this example a stream is compressed using gzip compression.
const compressedReadableStream = inputReadableStream.pipeThrough(
new CompressionStream("gzip"),
);
Specifications
SpecificationsStandards references are available on the canonical MDN page.
Browser compatibility
Browser compatibilityCompatibility data is available on the canonical MDN page.