3

FileSaver.js https://github.com/eligrey/FileSaver.js

Tested in Chrome and Safari. Chrome save file as download and Safari save file as unknown.

Tried

var blob = new Blob(["Hello, world!"], {type: "text/plain;charset=utf-8"});
FileSaver.saveAs(blob, "hello world.txt");

and

var file = new File(["Hello, world!"], "hello world.txt", {type: "text/plain;charset=utf-8"});
FileSaver.saveAs(file);

both not work.

phint
  • 31
  • 3
  • is `FileSaver` from an npm package? which one? There is a filesaver module but it doesn't have a `saveAs` function (https://www.npmjs.com/package/filesaver) – Always Learning May 20 '20 at 10:08
  • https://github.com/eligrey/FileSaver.js i download from this github, and use ` – phint May 20 '20 at 10:12

0 Answers0