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

ParameterTypeDescription
headersBothValueHeadersThe headers of the response
binaryEncodingTypesstring[]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