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

Parameter

Type

Description

headers

BothValueHeaders

The headers of the response

binaryContentTypes

string[]

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