From 7a628c0a551fca58599453caa91fc9c1d804a03f Mon Sep 17 00:00:00 2001 From: Sebastian Frank Date: Mon, 16 Aug 2021 10:35:56 +0200 Subject: [PATCH] added types --- index.d.ts | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 60 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index edbe260..d81a141 100644 --- a/index.d.ts +++ b/index.d.ts @@ -306,11 +306,70 @@ export interface HookContext extends GetHookData, PostHookData { * @param iso8859 iso string */ iso8859ToUtf8(iso8859: string): string + + /** + * convert image from source file to target file with filters + * + * @param sourceFile + * @param targetFile + * @param filters + */ + imageFilter( + sourceFile: string, + targetFile: string, + filters: { + fit?: boolean + fill?: boolean + width?: number + height?: number + brightness?: number + saturation?: number + contrast?: number + gamma?: number + blur?: number + sharpen?: number + invert?: boolean + grayscale?: boolean + quality?: number + }[] + ): void + + /** + * stat file or directory + * + * @param path + */ + fsStat(path: string): { + name: string + size: number + isDir: boolean + modTime: string + } + + /** + * list directory entries + * + * @param path + */ + fsReadDir(path: string): { + name: string + size: number + isDir: boolean + modTime: string + }[] + + /** + * make directory and all missing sub directories, no error if directory already exists + * + * @param path + */ + fsMkDir(path: string): void } export interface HookException { status?: number html?: string + file?: string [key: string]: any } @@ -321,4 +380,4 @@ export interface HookResponse extends GetHookData, PostHookData { declare global { var context: HookContext -} \ No newline at end of file +}