Skip to main content

isContentEncodingBinary

@h4ad/serverless-adapter > isContentEncodingBinary

(function) isContentEncodingBinary

The function that determines by the content encoding whether the response should be treated as binary

Signature:

export declare function isContentEncodingBinary(headers: BothValueHeaders, binaryEncodingTypes: string[]): boolean;

Parameters

Parameter

Type

Description

headers

BothValueHeaders

The headers of the response

binaryEncodingTypes

string[]

The list of content encodings that will be treated as binary

Returns:

boolean

Example

const headers = \{ 'content-encoding': 'gzip' };
const isBinary = isContentEncodingBinary(headers, ['gzip']);
console.log(isBinary);
// true