aws-sdk-q
v0.0.2
Published
Hack for adding the .q() method to all aws-sdk request objects (aws-sdk is a peerDependency)
Downloads
66
Readme
aws-sdk-q
Hack for adding the .q() method to all aws-sdk request objects (aws-sdk is a peerDependency).
How it works?
Take a look at the source the short version its a terrible hack into the AWS.Request object (which aws-sdk returns from just about all api calls).
Usage
// AWS is identical to aws-sdk but it has .promise method on all
// requests
var AWS = require('aws-sdk-q');
var ec2 = new AWS.EC2({ region: 'us-west-2' });
ec2.describeAccountAttributes({}).promise()
.then(function(data) {
// the promise is resolved on the 'complete' event of request object
console.log(JSON.stringify(req.data, null, 2));
})
.catch(function(error) {
// rejected if the 'complete' event contains an error
console.log(error);
});
Credit: https://github.com/aws/aws-sdk-js/issues/13#issuecomment-11868232