I am working on AWS with box api. I want to upload the file to s3 bucket using the lambda function. but giving the errors
I am using this api https://developer.box.com/en/reference/get-files-id-content/ to get the content of the file and upload to s3 bucket. But contents are in stream.
Below is my code
let status= await appUserClient.files.getReadStream(fileId, null, async function(error, stream) {
var params = {Bucket: 'bucketname', Key: 'key.csv', Body: stream};
let status= await s3.upload(params, function(err, data) {
if (err) {
console.log(err);
return 0;
}else{
console.log(data);
return 1;
}
}).promise();
});