Using bluebird promises, I am trying to check if a certain version of a file exists (always only ONE of those files exists but i don't know which one). To speed things up, I am using the any() collection to get all checking out concurrently:
Promise.any([
fs.existsAsync('./foo/image1.jpg'),
fs.existsAsync('./foo/image2.gif'),
fs.existsAsync('./foo/image3.png')
]).then(function(result) {
console.log(result); //remains undefined
});
I am always getting an undefined result. According to (How do I return the response from an asynchronous call?) this is normal behaviour of a resolved promise. Still, I need to know, which of my three promises resolved or maybe I just can't use any() for that purpose?