Provides a single callback for multiple asynchronous calls
Finish is a node utility module that provides a simple straight-forward way to catch the completion of multiple asynchronous tasks.
You can install using Node Package Manager (npm):
npm install finish
var Finish = require"finish";var finish = ;finishasync // Open an asynchronous region// Now you can make any asynchronous calls// Just wrap each asynchronous call with function 'spawn''file1' 'file2' 'file3'forEachspawnpathexists// Your async function should call done in its callback// 'result' passed into 'done' will be collected in the final callbackdoneerr result;;;;// This callback is fired after all asynchronous calls finish// results now equals an array of results received from by each 'done';
There are more detailed examples in the examples directory.
Finish can be use within recursive function calls. Just be sure to create a new finish instance in every recursive call.