mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-04-21 13:27:15 +08:00
file-saver: Allow saving files directly (#16045)
As documented on https://github.com/eligrey/FileSaver.js/ saving a file without using the Blob object should be possible
This commit is contained in:
@@ -19,3 +19,12 @@ function testSaveAs() {
|
||||
|
||||
saveAs(data, filename, disableAutoBOM);
|
||||
}
|
||||
|
||||
/**
|
||||
* @summary Test for "saveAs" function.
|
||||
*/
|
||||
function testSaveAsFile() {
|
||||
const data = new File(["Hello, world!"], "hello world.txt" ,{type: "text/plain;charset=utf-8"});
|
||||
|
||||
saveAs(data);
|
||||
}
|
||||
|
||||
10
types/file-saver/index.d.ts
vendored
10
types/file-saver/index.d.ts
vendored
@@ -1,6 +1,6 @@
|
||||
// Type definitions for FileSaver.js
|
||||
// Project: https://github.com/eligrey/FileSaver.js/
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>
|
||||
// Definitions by: Cyril Schumacher <https://github.com/cyrilschumacher>, Daniel Roth <https://github.com/DaIgeb>
|
||||
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
|
||||
|
||||
/**
|
||||
@@ -28,6 +28,14 @@ interface FileSaver {
|
||||
*/
|
||||
disableAutoBOM?: boolean
|
||||
): void
|
||||
|
||||
(
|
||||
/**
|
||||
* @summary File.
|
||||
* @type {File}
|
||||
*/
|
||||
data: File
|
||||
): void
|
||||
}
|
||||
|
||||
declare var saveAs: FileSaver;
|
||||
|
||||
Reference in New Issue
Block a user