1 | // Type definitions for FileSaver.js 2.0
|
2 | // Project: https://github.com/eligrey/FileSaver.js/
|
3 | // Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
4 | // Daniel Roth <https://github.com/DaIgeb>
|
5 | // HitkoDev <https://github.com/HitkoDev>
|
6 | // JounQin <https://github.com/JounQin>
|
7 | // BendingBender <https://github.com/bendingbender>
|
8 | // Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
9 |
|
10 | export = FileSaver;
|
11 |
|
12 | export as namespace saveAs;
|
13 |
|
14 | /**
|
15 | * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it.
|
16 | * @param data - The actual file data blob or URL.
|
17 | * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used.
|
18 | * @param options - Optional FileSaver.js config
|
19 | */
|
20 | declare function FileSaver(data: Blob | string, filename?: string, options?: FileSaver.FileSaverOptions): void;
|
21 |
|
22 | /**
|
23 | * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it.
|
24 | * @param data - The actual file data blob or URL.
|
25 | * @param filename - The optional name of the file to be downloaded. If omitted, the name used in the file data will be used. If none is provided "download" will be used.
|
26 | * @param disableAutoBOM - Optional & defaults to `true`. Set to `false` if you want FileSaver.js to automatically provide Unicode text encoding hints
|
27 | * @deprecated use `{ autoBom: false }` as the third argument
|
28 | */
|
29 | // tslint:disable-next-line:unified-signatures
|
30 | declare function FileSaver(data: Blob | string, filename?: string, disableAutoBOM?: boolean): void;
|
31 |
|
32 | declare namespace FileSaver {
|
33 | interface FileSaverOptions {
|
34 | /**
|
35 | * Automatically provide Unicode text encoding hints
|
36 | * @default false
|
37 | */
|
38 | autoBom: boolean;
|
39 | }
|
40 |
|
41 | const saveAs: typeof FileSaver;
|
42 | }
|