I would like main() to return the data instead of just console logging it as shown below. How do I do it?
async function main() {
// Load the AWS SDK for Node.js
var AWS = require("aws-sdk");
// Set the region
AWS.config.update({ region: "REGION" });
// Create S3 service object
s3 = new AWS.S3({ apiVersion: "2006-03-01" });
// Call S3 to list the buckets
s3.listBuckets(function (err, data) {
if (err) {
console.log("Error", err);
} else {
console.log(data);
}
});
}
main();