fix(types): getFileStream options types (#3500)

This commit is contained in:
kayikay 2019-02-28 13:59:37 +08:00 committed by 吖猩
parent 40ae443429
commit f9eea2a4da

24
index.d.ts vendored
View File

@ -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<FileStream>;
getFileStream(options?: GetFileStreamOptions): Promise<FileStream>;
/**
* @see Responce.redirect