Skip to main content

isBinary

@h4ad/serverless-adapter > isBinary

(function) isBinary

The function used to determine from the headers and the binary settings if a response should be encoded or not

Signature:

export declare function isBinary(headers: BothValueHeaders, binarySettings: BinarySettings): boolean;

Parameters

Parameter

Type

Description

headers

BothValueHeaders

The headers of the response

binarySettings

BinarySettings

The settings for the validation

Returns:

boolean

Example

const headers = \{ 'content-type': 'image/png', 'content-encoding': 'gzip' };
const isContentBinary = isBinary(headers, \{ contentEncodings: ['gzip'], contentTypes: ['image/png'] });
console.log(isContentBinary);
// true