-
-
Save stormoz/1a3a6970925f7ff69b6b2896799a51fb to your computer and use it in GitHub Desktop.
axios get request w/ piping
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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