UNPKG

hastily

Version:

express middleware to simulate fastly cdn

28 lines (27 loc) 1.03 kB
import { Request } from 'express'; import { Color, ExtendOptions, Region } from 'sharp'; import { IFastlyParams, IMutableResponse, NumericParams, Param, Warning, WarnType } from './imageopto-types'; import { Logger } from 'pino'; export default class FastlyParams implements IFastlyParams { get quality(): number | undefined; req: Request; res: IMutableResponse; log: Logger; private raw; private warnings; private cachedQuality; private rgbRE; constructor(params: Map<string, string | undefined>, req: Request, res: IMutableResponse); get(param: Param): Param; has(param: Param): boolean; warn(type: WarnType, param: Param, msg?: string): void; getWarnings(): Warning[]; toNumbers(names: Param[]): NumericParams; toCssBox(name: Param): ExtendOptions; toColor(name: Param): Color; toTaggedValues(name: Param, positional: string[], named: string[]): { [key: string]: string | null; }; toRegion(name: Param): Partial<Region>; private warnFail; }