Skip to content

Instantly share code, notes, and snippets.

View leewanvu's full-sized avatar

Vu Le leewanvu

  • Ho Chi Minh, Viet Nam
View GitHub Profile
leewanvu / download-file.js
Created October 25, 2018 10:08 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
url: 'http://localhost:5000/static/example.pdf',
method: 'GET',
responseType: 'blob', // important
}).then((response) => {
const url = window.URL.createObjectURL(new Blob([]));
const link = document.createElement('a');
link.href = url;
link.setAttribute('download', 'file.pdf');