AWS Doable Style
The AWS framework for Node
has been around for a while, and for such reasons probably have to live with backward compatibility. One of the things that has annoyed me with the API is the usage of callbacks. I mean, that’s all fine, but many people these days problably want to use promises and async / await
instead. Turns out that’s not very difficult.
They’ve added support for that by putting a .promise()
function on the returned value. See code of the day for an example.
Code of the Day
await s3Client.createBucket(
{
Bucket: bucketName
}
).promise();
Simply don’t give a callback and just call .promise()
instead.