简体   繁体   中英

getObject from aws s3 got gibberish

in our project we have 1 service that uploads a local csv to s3, and I am working on another service which downloads csv that's uploaded using nodejs. I got gibberish in the content as i try to print the string of content (small csv). code :

 s3.getObject( { Bucket: mybucket, Key:mykey }, function(err,data){ console.log(data.Body.toString()) ; }) 

I have checked the data object that in the callback and found the type for buffer of data is unit8Array. I guess that's the cause. Does anyone know how I can control the type of buffer to be String? or is it something that needs to be changed during upload?

This is solved on the file upload side which is written in java. it was using AmazonS3EncryptionClientBuilder instead of AmazonS3ClientBuilder. as a result data coming back when downloading is encrypted that's why its gibberish. so it was not caused by buffer type

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM