开发者

Unable to write file in proper format after reading from the S3 url using nodejs

开发者 https://www.devze.com 2022-12-07 17:36 出处:网络
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

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.

0

精彩评论

暂无评论...
验证码 换一张
取 消