TypeError: task is not a function in async js parrallel
async.series
and most of the async
control flow functions expect functions or arrays of functions to be returned, e.g.
async.series([ function () {}, function () {}])
The return values of your two function calls, uploadImage
and ProcessUpload
are not functions. async
errors out.
Instead you would have to write this as something like:
async.series([ function (callback) { // callback has to be called by `uploadImage` when it's done uploadImage(path,destFolder,destination, callback); },]);
You can also simplify this a bit by passing a null object to bind()
:
async.series( [ uploadImage.bind( null, path, destFolder, destination ), ProcessUpload.bind( null, optionalController, opts, res )] );