@bitpatty/imgproxy-url-builder
Version:
A TypeScript helper library for building imgproxy URLs
30 lines (29 loc) • 1.16 kB
TypeScript
/**
* Stringifies the imgproxy modifier for use within the
* imgproxy URL.
*
* @param opCode The operation key
* @param values The values
* @returns The stringified modifier
*/
declare const stringifyOptions: (opCode: string, values: Array<string | number | boolean | undefined>) => string;
/**
* Encodes the filepath to base64url.
*
* @param filePath The file path
* @returns The base64url encoded file path
*/
declare const encodeFilePath: (filePath: string) => string;
/**
* Generates the URL signature for the specified imgproxy param string.
*
* See https://github.com/imgproxy/imgproxy/blob/947d65cf29fe26e5e4d38ca8a17e44c7402e437c/docs/configuration.md#url-signature
*
* @param paramString The param string
* @param key The hex-encoded key
* @param salt The hex-encoded salt
* @param length The number of bytes to use for the signature before encoding to Base64
* @returns The base64url encoded signature
*/
declare const generateSignature: (paramString: string, key: string, salt: string, length: number) => string;
export { stringifyOptions, encodeFilePath, generateSignature };