UNPKG

1.49 kBTypeScriptView Raw
1export = FileSaver;
2
3export as namespace saveAs;
4
5/**
6 * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it.
7 * @param data - The actual file data blob or URL.
8 * @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.
9 * @param options - Optional FileSaver.js config
10 */
11declare function FileSaver(data: Blob | string, filename?: string, options?: FileSaver.FileSaverOptions): void;
12
13/**
14 * FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it.
15 * @param data - The actual file data blob or URL.
16 * @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.
17 * @param disableAutoBOM - Optional & defaults to `true`. Set to `false` if you want FileSaver.js to automatically provide Unicode text encoding hints
18 * @deprecated use `{ autoBom: false }` as the third argument
19 */
20// tslint:disable-next-line:unified-signatures
21declare function FileSaver(data: Blob | string, filename?: string, disableAutoBOM?: boolean): void;
22
23declare namespace FileSaver {
24 interface FileSaverOptions {
25 /**
26 * Automatically provide Unicode text encoding hints
27 * @default false
28 */
29 autoBom: boolean;
30 }
31
32 const saveAs: typeof FileSaver;
33}