diff --git a/README.md b/README.md index 56d1285..d49e04c 100644 --- a/README.md +++ b/README.md @@ -33,8 +33,8 @@ The Synchronous version still uses callbacks, so it is safe to use with other As options = { followLinks: false, - // asyncFilters: ["Temp", "_Temp"] // directories with these - // keys will be skipped + // filters: ["Temp", "_Temp"] // directories with these + // keys will be skipped }; walker = walk.walk("/tmp", options); diff --git a/lib/walk.js b/lib/walk.js index 8e34fd8..31aabca 100644 --- a/lib/walk.js +++ b/lib/walk.js @@ -35,7 +35,7 @@ me._wq = []; me._wqueue = [me._wq]; me._wcurpath = undefined; - me._wasyncFilters = options.asyncFilters; + me._wfilters = options.filters; me._wfirstrun = true; me._wcurpath = pathname; @@ -176,12 +176,27 @@ , me = this ; - try { - files = fs.readdirSync(me._wcurpath); - } catch(e) { - err = e; + // Stop directories that contain filter keywords + // from continuing through the walk process + if (me._wfilters != undefined) { + var shouldExclude = false; + for (var iFilter=0; iFilter