Resolve promises one after another (i.e. in sequence)?

Consider the following code that reads an array of files in a serial/sequential manner. readFiles returns a promise, which is resolved only once all files have been read in sequence. var readFile = function(file) { … // Returns a promise. }; var readFiles = function(files) { return new Promise((resolve, reject) => { var readSequential = … Read more