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 | The headers of the response | |
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