s3.getobject nodejs example async await
const AWS = require('aws-sdk');
const s3 = new AWS.S3();
const getObject = async () => {
try {
const params = {
Bucket: 'your-bucket-name',
Key: 'your-object-key'
};
const data = await s3.getObject(params).promise();
console.log(data.Body.toString('utf-8'));
} catch (error) {
console.error(error);
}
};
getObject();