/wiothen

Promise, then, on filepaths in a directory tree (beta code)

Primary LanguageJavaScript

wiothen

Promise, then, on filepaths in a directory tree

This is BETA.

Usage

var wiothen = require('wiothen');

wiothen('.', function(filepath, next) {
  // Skip dotfiles, coverage, node_modules
  if (!/^(\.|coverage|node_modules)/
    .test(filepath))
    console.log('got filepath:', filepath);
  next();
})
.then(function () {
  console.log('no more filepaths');
})
.catch(function (err) {
  console.log('got error:', err.message);
  return;
});

Output:

got filepath: package.json
got filepath: index.js
got filepath: README.md
no more filepaths