Adi – 16-14 Jan 29

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));
}
E
Eva810d ago
specify responseType? axios.get(url, { responseType: 'stream' }) ... And res is a response, not data, so it'd be res.data.pipe
UU
Unknown User809d ago