Adi
Adi3y ago

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));
}
2 Replies
Eva
Eva3y ago
specify responseType? axios.get(url, { responseType: 'stream' }) ... And res is a response, not data, so it'd be res.data.pipe
reactibot
reactibot3y ago
This thread hasn’t had any activity in 12 hours, so it’s now locked. Threads are closed automatically after 12 hours. If you have a followup question, you may want to reply to this thread so other members know they're related. https://discord.com/channels/102860784329052160/565213527673929729/937017859375247380