When trying to download a file from s3, through s3.getObject(params),createReadStream() method,
var AWS = require('aws-sdk');
var s3 = new AWS.S3({
accessKeyId: 'xx',
secretAccessKey: 'xx',
region: 'x',x
httpOptions: { timeout: 200000 }
});
var params = {
Bucket: "xx",
Key: 'xx'
}
var s3Stream = s3.getObject(params).createReadStream()
.on('error', function (err) {
console.log('READSTREAM error');
console.log(err);
})
.on('end', function () { });
it gives me the error:
TypeError: Cannot read properties of undefined (reading 'Stream')
use "@aws-sdk/client-s3": "^3.54.1", "aws-sdk": "^2.1095.0",
any idea what can happen?