node.js:蓝鸟替代async.whilst?

我想运行一个while循环,这取决于每次迭代更新的条件。 现在的挑战是每次迭代中的代码都是asynchronous的。

一种通过使用async.whilst()来实现这一点的方法。 不过,我正在试图寻找一个使用蓝鸟承诺的替代品。 有没有这样的替代品?

我build议你这个库: https : //www.npmjs.com/package/async-bluebird具有相同的asyncfunction,但使用蓝鸟。

你试过这个吗? .all() – > Promise

 var pendingPromises = []; while (yourConditions) { pendingPromises.push(service.doSomethingAsync()); } Promise.all(pendingPromises).then(function(result) { console.log("all the files were created", result); });