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