Skip to content

Commit

Permalink
fix(types): getFileStream options types (#3500)
Browse files Browse the repository at this point in the history
  • Loading branch information
kayikay authored and whxaxes committed Feb 28, 2019
1 parent 40ae443 commit f9eea2a
Showing 1 changed file with 23 additions and 1 deletion.
24 changes: 23 additions & 1 deletion index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit f9eea2a

Please sign in to comment.