Package Exports
- walkitout
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (walkitout) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
walkitout
Run a callback, asynchronously, on all filepaths in a directory tree
Usage
var walkitout = require('walkitout');
console.log("START WALK");
/**
* @param path {string} path to walk
* @param callback {function} callback handler
* @param finish {function} optional finish handler
* @param scope {object} optional handler scope
* @param control {function} optional descend controller
*/
walkitout('.', processLog, processComplete, null, controlDescend)
console.log("WALK STARTED");
function processLog(err, filename, done) {
if (err) throw err;
// skip: dotfiles, coverage, node_modules
if (!/^(\.|coverage|node_modules)/
.test(filename)) {
console.log('FILE:', filename);
}
done();
}
function processComplete() {
console.log('COMPLETE: wrap up processing ');
}
function controlDescend(dirname, dirPath, descend, skip, depth) {
// skip directories named test,
// only walk a max-depth of 2 levels
(dirname === 'test' || depth === 2) ?
skip() : descend();
}Output:
START WALK
WALK STARTED
FILE: package.json
FILE: index.js
FILE: README.md
COMPLETE: wrap up processing 