Bruce Dou Bruce Dou - 1 year ago 99
Node.js Question

What is the difference between async.waterfall and async.series

The nodejs async module: provides 2 similar methods,


What is the difference between them?

Answer Source

It appears that async.waterfall allows each function to pass its results on to the next function, while async.series passes all results to the final callback. At a higher level, async.waterfall would be for a data pipeline ("given 2, multiply it by 3, add 2, and divide by 17"), while async.series would be for discrete tasks that must be performed in order, but are otherwise separate.