Unable to write file in proper format after reading from the S3 url using nodejs
I am trying to write excel file after reading from the S3 bucket url with the help of axios data is written into the file but its not in readable format. I want to开发者_开发问答 write data in proper excel file format
format in which it was being uploaded.
Below is my code:
axios({
url: 'https://parse-excel-log-files.s3.amazonaws.com/1666960010753_Me%20Data.xlsx',
method: 'GET',
responseType: 'blob',
}).then((response) => {
const ostream = fs.createWriteStream(`./${filename}`);
ostream.write(response.data);
});
Someone let me know what I am doing wrong.
精彩评论