Skip to content

Instantly share code, notes, and snippets.

View auroraveon's full-sized avatar
🩷
being cute :3

Aurora auroraveon

🩷
being cute :3
  • null
  • 21:19 (UTC +01:00)
View GitHub Profile
@javilobo8
javilobo8 / download-file.js
Last active March 17, 2025 14:25
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);