Skip to content

Instantly share code, notes, and snippets.

@stormoz
Forked from bhuizi/axios_get_pipe_zip.js
Created July 25, 2019 13:29
Show Gist options
  • Save stormoz/1a3a6970925f7ff69b6b2896799a51fb to your computer and use it in GitHub Desktop.
Save stormoz/1a3a6970925f7ff69b6b2896799a51fb 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