promise chain
["file1", "file2", "file3"]
.map(getFile) // getFile returns a promise
.reduce(
function(chain, filePromise) {
return
chain.then(function() {
return filePromise;
})
.then(output);
},
Promis.Resolve()
)
.then(function() {
output("Complete!");
});