Need private packages and team management tools?Check out npm Teams »

file-downloader

2.1.0 • Public • Published

file-downloader

A fetch-based file downloader for a browser

Install

Install as bower component

bower install file-downloader

or use npm

npm install file-downloader

Usage

Simple download with filename:

downloader.get("/reports/myCsvReport", "report.csv")
  .then(function (filename) {
    console.log("File " + filename + " has been downloaded!");
  });

Provide custom request headers if needed:

downloader.get("/reports/myCsvReport", "report.csv", {
    "Authorization": "R2l2ZSBtZSB0aGUgZmlsZSwgZGF3ZyE="
  })
  .then(function (filename) {
    console.log("File " + filename + " has been downloaded!");
  });

Dependencies

file-downloader uses Fetch API and Promises. Provide appropriate polyfills if you want to support old browsers. Check browser compatibility at

License

MIT

Install

npm i file-downloader

DownloadsWeekly Downloads

4

Version

2.1.0

License

MIT

Last publish

Collaborators

  • avatar