3 ms·
A silly example: var Promise = require('bluebird'); var fs = Promise.promisifyAll(require('fs')); var and = require('101/and'); var paths = [...];
by noisysocks 12y ago
A silly example:
var Promise = require('bluebird');
var fs = Promise.promisifyAll(require('fs'));
var and = require('101/and');
var paths = [...];
Promise.map(paths, fs.existsAsync).reduce(and)
.then(function(allExist) {
if (allExist) console.log('all paths exist');
});