There are some scenarios, where we would like to have multiple system processes spawned as child processes from nodeJs. For Instance,  if we wanted to do a batch download of resources from some other server etc.

The gist link contains one such example. The simplest way to identify and get result back from each individual spawned processes is to create the task itself as separate class / function enclosure. So we call all these tasks in their context and perhaps add in a callback with specific identifier associated with each spawned task.

Advertisements