files/en-us/web/api/compressionstream/index.md
{{APIRef("Compression Streams API")}}{{AvailableInWorkers}}
The CompressionStream interface of the {{domxref('Compression Streams API','','',' ')}} compresses a stream of data. It implements the same shape as a {{domxref("TransformStream")}}, allowing it to be used in {{domxref("ReadableStream.pipeThrough()")}} and similar methods.
CompressionStream.In this example a stream is compressed using gzip compression.
const compressedReadableStream = inputReadableStream.pipeThrough(
new CompressionStream("gzip"),
);
{{Specifications}}
{{Compat}}