kinetex - v1.0.0-rc.1
    Preparing search index...

    Function applyDecompression

    • Detect and apply decompression based on Content-Encoding header.

      Supports gzip, deflate, and brotli (Node.js only). For multiple encodings (e.g., "gzip, br"), decompresses in reverse order: first outermost (gzip), then inner (brotli).

      Uses DecompressionStream in browsers/Deno/Bun/Workers, and node:zlib in Node.js for brotli support.

      Parameters

      • stream: ReadableStream<Uint8Array<ArrayBufferLike>>

        The incoming ReadableStream (possibly compressed).

      • headers: Record<string, string>

        The response headers (content-encoding read from here).

      Returns ReadableStream<Uint8Array<ArrayBufferLike>>

      The decompressed ReadableStream (or original if no encoding).