It would be probably cleaner to prepare internal promise chain for each file, instead of calling `map` multiple times.