Skip to content

Instantly share code, notes, and snippets.

Tomassito

Block or report user

Report or block Tomassito

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@Tomassito
Tomassito / download-file.js
Last active Jan 15, 2020 — forked from javilobo8/download-file.js
Download files with AJAX (axios)
View download-file.js
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');
link.click();
You can’t perform that action at this time.