Last Updated on January 24, 2024 by Justin Su

This article is a tutorial and simple guide on how to download files with Axios. Let’s start learning how it works.

What Is Axios?

Axios is a simple promise-based HTTP client for the browser and node.js. Axios provides a simple-to-use library in a small package with a very extensible interface.

It has been used mainly for basic HTTP GET & POST requests.

Also Read: How To Start Quiz Site

Also Read: How To Create Micro Job Sites

How To Download Files With Axios

Use the following code provided by a Javilobo user on GitHub. You can use to download pdf and Excel using the code easily.

url: ‘’, //your url
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’); //or any other extension

Click here to visit the official website of Axios download file. It includes the Axios get file.