Creates a new CompressionStream
object which compresses a stream of data.
Throws a TypeError
if the format passed to the constructor is not supported.
const gzip = new CompressionStream("gzip");
The compression format to use.
Readonly
readablelet stream = new CompressionStream("gzip");
console.log(stream.readable instanceof ReadableStream); // true
Readonly
writablelet stream = new CompressionStream("gzip");
console.log(stream.writable instanceof WritableStream); // true
Generated using TypeDoc
An API for compressing a stream of data.
See
CompressionStream on MDN
Example
In this example a request is made to httpbin.org/html and the response body is compressed using gzip compression.
View this example on Fiddle.