Skip to content

Instantly share code, notes, and snippets.

View albasyir's full-sized avatar
🏄‍♂️
always achive goals in enjoy!

Abdul Aziz Al Basyir albasyir

🏄‍♂️
always achive goals in enjoy!
  • Zenmirai
  • Indonesia
  • 00:20 (UTC +07:00)
  • LinkedIn in/albasyir
View GitHub Profile
@albasyir
albasyir / download-file.js
Created October 19, 2020 05:12 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
axios({
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([response.data]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');
document.body.appendChild(link);