I am using Angular2 for my application and I have to consume Amazon S3 javascript sdk for browser. I have the following function:
getBuckets() {
        var s3 = this.getS3();
        var params = {};
        s3.listBuckets(params, function(err, response) {
            if (err) {
                // What to return?
            }
            else {
                // What to return?
            }
        })
}
s3.listBuckets is the javascript API from Amazon for S3. It is expecting a call back function. But the caller of getBuckets is expecting a Promise. How should I change the above getBuckets(), such that the caller of getBuckets(), will look like:
getBuckets().then(
...
)
Thanks in advance.
 
     
     
     
    