Created
March 7, 2014 20:59
-
-
Save lsegal/9420007 to your computer and use it in GitHub Desktop.
Uses promises with the AWS SDK for JavaScript
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'); | |
var s3 = new AWS.S3(); | |
var Q = require('q'); | |
var list = Q.nbind(s3.listBuckets.bind(s3)); | |
list().then(function(data) { | |
console.log(data); | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var AWS = require('aws-sdk'); | |
var s3 = new AWS.S3(); | |
var promisify = require('when-promisify'); | |
var list = promisify(s3.listBuckets.bind(s3)); | |
list().then(function(data) { | |
console.log(data); | |
}); | |
// alternate method | |
var list = promisify(s3, 'listBuckets'); | |
list().then(function(data) { | |
console.log(data); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment