I have some code like so:
var downloadFiles = function () {
console.log('downloading files');
aFtpClient.
listAsync().
then(processListing).
map(function (object) {
return processItem(object);
}).
then(downloadItem).
catch (TypeError, function (e) {
console.dir('arse' + e);
}).
catch (Promise.RejectionError, function (e) {
console.error("unable to read file, because: ", e.message);
});
console.log('after downloading files');
};
processListing
returns an array of objects with source & destination properties. I use map
to deal with the array and call processItem
. Is there a way to pass the mapped object to downloadItem
?