While using an async.series based design, I have to use a loop within a function block as shown below:
var someFile = filePath;
async.series([
function(cb) {
_.forEach (
someDataList,
function (item) {
//call that executes out of sync
writeToFile(someFile,item)
//how to provide callback here
cb(); //<- is this correct - won't this take control out of this block in the very first loop iteration?
}
);
}
],
//callback function
function (err) {...}
);