-
Notifications
You must be signed in to change notification settings - Fork 38
/
index.d.ts
37 lines (34 loc) · 1.14 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
declare module 'js-file-downloader' {
export interface OptionalParams {
timeout?: number;
headers?: { name: string, value: string }[];
forceDesktopMode?: boolean;
withCredentials?: boolean;
method?: 'GET' | 'POST';
process?: (event: ProgressEvent) => undefined;
nameCallback?: (name: string) => string;
autoStart?: boolean;
filename?: string;
contentType?: false | string;
body?: Document | BodyInit | null;
nativeFallbackOnError?: boolean;
onloadstart?: () => void;
contentTypeDetermination?: false | 'header' | 'signature' | 'full';
customFileSignatures?: { [key: string]: string };
}
type Params = OptionalParams & { url: string };
interface JsFileDownloaderBase {
start(): Promise<void>;
params: Params;
link: HTMLAnchorElement;
request: XMLHttpRequest;
downloadedFile: null | Blob | File;
abort(reason: any): void;
}
interface JsFileDownloaderContructor {
new (data?: Params & { autoStart: false }): JsFileDownloaderBase;
new (data?: Params): Promise<void>;
}
const JsFileDownloader: JsFileDownloaderContructor;
export default JsFileDownloader;
}