DecompressionStream.DecompressionStream()

The DecompressionStream() constructor creates a new DecompressionStream object which decompresses a stream of data.

Syntax

let DecompressionStream = new DecompressionStream(format);

Parameters

format
One of the following compression formats:
  • "gzip"
  • "deflate"

Exceptions

TypeError
Thrown if the format passed to the constructor is not supported.

Examples

In this example a blob is decompressed using gzip compression.

const ds = new DecompressionStream('gzip');
const decompressedStream = blob.stream().pipeThrough(ds);

Specifications

Specification Status Comment
Compression Streams
The definition of 'DecompressionStream()' in that specification.
Draft Initial definition.

Browser compatibility

BCD tables only load in the browser