Skip to content

Instantly share code, notes, and snippets.

@bhuizi
Last active October 27, 2021 14:09
Show Gist options
  • Star 9 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bhuizi/c38ae195172766d90e2aaf5e1f023672 to your computer and use it in GitHub Desktop.
Save bhuizi/c38ae195172766d90e2aaf5e1f023672 to your computer and use it in GitHub Desktop.
axios get request w/ piping
const axios = require('axios');
const fs = require('fs');
const url = <path_to_file>
axios({
method: 'get',
url: url,
responseType:'stream'
})
.then(res => {
res.data.pipe(fs.createWriteStream('new.zip'));
})
.catch(err => console.log(err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment