(maybe) decompresses a stream
jsr.io/@mary/maybe-decompression-stream
jsr
typescript
1# maybe-decompression-stream
2
3[JSR](https://jsr.io/@mary/maybe-decompression-stream) | [source code](https://tangled.sh/mary.my.id/pkg-maybe-decompression-stream)
4
5decompresses a stream of data if it is compressed with gzip, otherwise it passes the data through.
6
7```ts
8const response = await fetch('resource.tgz');
9
10const stream = response.body.pipeThrough(new MaybeDecompressionStream());
11
12for await (const chunk of stream) {
13 // ...
14}
15```