file-downloader
v2.1.0
Published
A fetch-based file downloader for client-side js
Downloads
31
Readme
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