Skip to content

decodeContentEncoding

function decodeContentEncoding(
data,
contentEncoding,
maxOutputSize?): Promise<Uint8Array<ArrayBufferLike>>;

Defined in: src/http/common.ts:52

Decode an HTTP body per its Content-Encoding, or return it unchanged.

Handles the codings vgi-rpc speaks (zstd, gzip); the header may list several applied in order, which are decoded in reverse. Unknown / identity codings are left as-is. Intended for an intermediary (proxy, gateway) that must read a compressed request or response body to inspect or rewrite it.

Parameter Type
data Uint8Array
contentEncoding string | null | undefined
maxOutputSize? number

Promise<Uint8Array<ArrayBufferLike>>