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

ParameterTypeDescription
headersBothValueHeadersThe headers of the response
binarySettingsBinarySettingsThe 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