Since the execution of any async task using the Async library is always signaled by a completion callback, you can simply defer the call by placing it in setTimeout(). Here is an example adapted from an example in async doc:
async.eachSeries(hugeArray, function iterator(item, callback) {
doSomeIO(item, function(err, result) {
setTimeout(function() {
callback(err);
}, 500);
});
}
}, function done() {
});
source
share