| 1 |
# Installation |
| 2 |
> `npm install --save @types/file-saver` |
| 3 |
|
| 4 |
# Summary |
| 5 |
This package contains type definitions for FileSaver.js (https://github.com/eligrey/FileSaver.js/). |
| 6 |
|
| 7 |
# Details |
| 8 |
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/file-saver. |
| 9 |
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/file-saver/index.d.ts) |
| 10 |
````ts |
| 11 |
// Type definitions for FileSaver.js 2.0 |
| 12 |
// Project: https://github.com/eligrey/FileSaver.js/ |
| 13 |
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher> |
| 14 |
// Daniel Roth <https://github.com/DaIgeb> |
| 15 |
// HitkoDev <https://github.com/HitkoDev> |
| 16 |
// JounQin <https://github.com/JounQin> |
| 17 |
// BendingBender <https://github.com/bendingbender> |
| 18 |
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped |
| 19 |
|
| 20 |
export = FileSaver; |
| 21 |
|
| 22 |
export as namespace saveAs; |
| 23 |
|
| 24 |
/** |
| 25 |
* FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. |
| 26 |
* @param data - The actual file data blob or URL. |
| 27 |
* @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. |
| 28 |
* @param options - Optional FileSaver.js config |
| 29 |
*/ |
| 30 |
declare function FileSaver(data: Blob | string, filename?: string, options?: FileSaver.FileSaverOptions): void; |
| 31 |
|
| 32 |
/** |
| 33 |
* FileSaver.js implements the saveAs() FileSaver interface in browsers that do not natively support it. |
| 34 |
* @param data - The actual file data blob or URL. |
| 35 |
* @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. |
| 36 |
* @param disableAutoBOM - Optional & defaults to `true`. Set to `false` if you want FileSaver.js to automatically provide Unicode text encoding hints |
| 37 |
* @deprecated use `{ autoBom: false }` as the third argument |
| 38 |
*/ |
| 39 |
// tslint:disable-next-line:unified-signatures |
| 40 |
declare function FileSaver(data: Blob | string, filename?: string, disableAutoBOM?: boolean): void; |
| 41 |
|
| 42 |
declare namespace FileSaver { |
| 43 |
interface FileSaverOptions { |
| 44 |
/** |
| 45 |
* Automatically provide Unicode text encoding hints |
| 46 |
* @default false |
| 47 |
*/ |
| 48 |
autoBom: boolean; |
| 49 |
} |
| 50 |
|
| 51 |
const saveAs: typeof FileSaver; |
| 52 |
} |
| 53 |
|
| 54 |
```` |
| 55 |
|
| 56 |
### Additional Details |
| 57 |
* Last updated: Tue, 11 Jan 2022 22:31:38 GMT |
| 58 |
* Dependencies: none |
| 59 |
* Global values: `saveAs` |
| 60 |
|
| 61 |
# Credits |
| 62 |
These definitions were written by [Cyril Schumacher](https://github.com/cyrilschumacher), [Daniel Roth](https://github.com/DaIgeb), [HitkoDev](https://github.com/HitkoDev), [JounQin](https://github.com/JounQin), and [BendingBender](https://github.com/bendingbender). |