From f9eea2a4da805a1b2f0e8883860266d68eb432ff Mon Sep 17 00:00:00 2001 From: kayikay <469797590@qq.com> Date: Thu, 28 Feb 2019 13:59:37 +0800 Subject: [PATCH] fix(types): getFileStream options types (#3500) --- index.d.ts | 24 +++++++++++++++++++++++- 1 file changed, 23 insertions(+), 1 deletion(-) diff --git a/index.d.ts b/index.d.ts index dedf0cc4f9..7d09767211 100644 --- a/index.d.ts +++ b/index.d.ts @@ -676,6 +676,27 @@ declare module 'egg' { truncated: boolean; } + + interface GetFileStreamOptions { + requireFile?: boolean; // required file submit, default is true + defCharset?: string; + limits?: { + fieldNameSize?: number; + fieldSize?: number; + fields?: number; + fileSize?: number; + files?: number; + parts?: number; + headerPairs?: number; + }; + checkFile?( + fieldname: string, + file: any, + filename: string, + encoding: string, + mimetype: string + ): void | Error; + } /** * KoaApplication's Context will carry the default 'cookie' property in @@ -893,10 +914,11 @@ declare module 'egg' { * console.log(stream.fields); * ``` * @method Context#getFileStream + * @param {Object} options * @return {ReadStream} stream * @since 1.0.0 */ - getFileStream(): Promise; + getFileStream(options?: GetFileStreamOptions): Promise; /** * @see Responce.redirect