Skip to main content

isContentTypeBinary

@h4ad/serverless-adapter > isContentTypeBinary

(function) isContentTypeBinary

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

Signature:

export declare function isContentTypeBinary(headers: BothValueHeaders, binaryContentTypes: string[]): boolean;

Parameters

ParameterTypeDescription
headersBothValueHeadersThe headers of the response
binaryContentTypesstring[]The list of content types that will be treated as binary

Returns:

boolean

Example

const headers = \{ 'content-type': 'image/png' };
const isBinary = isContentTypeBinary(headers, new Map([['image/png', true]]));
console.log(isBinary);
// true