-
Notifications
You must be signed in to change notification settings - Fork 14
/
index.d.ts
43 lines (35 loc) · 1.06 KB
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
declare module 'image-downloader' {
import { RequestOptions } from 'http';
type Options = Pick<RequestOptions, 'headers' | 'auth' | 'agent' | 'timeout' | 'maxHeaderSize'> & {
/**
* The image URL to download
*/
url: string;
/**
* The image destination. Can be a directory or a filename.
* If a directory is given, ID will automatically extract the image filename
* from `options.url`
*/
dest: string;
/**
* Boolean indicating whether the image filename will be automatically extracted
* from `options.url` or not. Set to `false` to have `options.dest` without a
* file extension for example.
* @default true
*/
extractFilename?: boolean;
/**
* The maximum number of allowed redirects; if exceeded, an error will be emitted.
* @default 21
*/
maxRedirects?: number;
}
type DownloadResult = {
/**
* The downloaded filename
*/
filename: string,
};
// eslint-disable-next-line no-unused-vars
function image(options: Options): Promise<DownloadResult>;
}