Using promises instead of callbacks #1450

Closed
activatedgeek opened this Issue Jun 24, 2015 · 5 comments

Projects

None yet

3 participants

@activatedgeek

Is it possible to use promises instead of callbacks?

For instance, consider this code:

var blobStorage = new storage.createBlobService(accountName, accountKey);

blobStorage.createContainerIfNotExists('assets', {
  publicAccessLevel: 'blob'
},
function(error, result, response) {
  if(error) {
    console.error(error);
    process.exit();
  }
  else if(result) {
    console.log('Container created.');
  }
  else {
    console.log('Container already exists. Moving on..');
  }
});

With promises such as:

blobStorage.createContainerIfNotExists('assets', {
  publicAccessLevel: 'blob'
})
.then(function(success){}, function(err){});
@activatedgeek

How does that help?

@mauricionr

reading the method docs "createContainerIfNotExists" and check it out if support promises callbacks instead fn as parameter

@markcowl
Member

@activatedgeek promises are not currently supported - we use the more common callback mechanism.

The calls you are asking about are in the storage data plane library and not just the storage management library, this library may have different promises support, see:https://github.com/Azure/azure-storage-node

Please file any issues for storage data plane apis in that repo.

@markcowl markcowl closed this Jun 29, 2015
@mauricionr

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment