R
Reactiflux

help-js

Adi – 16-14 Jan 29

AAdi1/29/2022
I am getting res.pipe() is not a function error any idea why so? code:
const saveMediaToDisk = (url, path) => {
const localpath = fs.createWriteStream(path);

return axios.get(url).then(res => res.pipe(localpath)).catch(error => console.log("error", error));
}
const saveMediaToDisk = (url, path) => {
const localpath = fs.createWriteStream(path);

return axios.get(url).then(res => res.pipe(localpath)).catch(error => console.log("error", error));
}
EEva1/29/2022
specify responseType? axios.get(url, { responseType: 'stream' }) ... And res is a response, not data, so it'd be res.data.pipe
UUUnknown User1/30/2022
Message Not Public
Sign In & Join Server To View

Looking for more? Join the community!