walkitout
Run a callback, asynchronously, on all filepaths in a directory tree
Usage
var walkitout = ; console; /** * @param * @param * @param * @param (object} scope optional handler scope * @param * * @returns */var cancelWalk = console; { if err throw err; // skip: dotfiles, coverage, node_modules if !/^/ console; ;} { // "cancelled" is true if cancelWalk() was invoked var info = '(' + cancelled ? '' : 'not ' + 'cancelled)'; console;} { // skip directories named test, // only walk a max-depth of 2 levels dirname === 'test' || depth === 2 ? : ;}
Output:
START WALKWALK STARTEDFILE: package.jsonFILE: index.jsFILE: README.mdCOMPLETE: wrap up processing (not cancelled)