Skip to content

Commit

Permalink
fileName {ext} type now also optional and boolean (#51)
Browse files Browse the repository at this point in the history
This fixes the typing for fileName property, now accepting:

`fileName: {name: 'xyz'}`
`fileName: {name: 'xyz', ext: true}` or false, stating false is the default
`fileName: {name: 'xyz', ext: 'jpg'}` as already was accepted
  • Loading branch information
ftzi authored Aug 17, 2021
1 parent bed68d5 commit 1306bc8
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,11 @@ interface DownloadEvents {
type FilenameCallback = (fileName: string, filePath: string) => string;
interface FilenameDefinition {
name: string;
ext: string;
/** The extension of the file. It may be a boolean: `true` will use the `name` property as the full file name (including the extension),
`false` will keep the extension of the downloaded file.
(default:false) */
ext?: string | boolean;
}
interface RetryOptions {
maxRetries: number;
Expand All @@ -122,7 +126,7 @@ interface DownloaderHelperOptions {
removeOnStop?: boolean;
/** remove the file when fail (default:true) */
removeOnFail?: boolean;
/** Behavior when local file already exists */
/** Behavior when local file already exists (default:false)*/
override?: boolean | OverrideOptions;
/** Override the http request options */
httpRequestOptions?: object;
Expand Down

0 comments on commit 1306bc8

Please sign in to comment.