fs-recurse
Walk through directories asynchronously, with callback on each file/folder and ignore option
Usage
npm install fs-recurse
Signature
recurse(String path, Function callback, Function done, Array ignore);
Arguments
-
path String
Path in which you want to recurse
-
callback Function
Receives four arguments :
path String
current pathfilename String
current file nametype String
file extension or 'folder'cursor Function
call this function after executing any async operation on current file
-
done Function
Invoked when recursion is done
-
ignore Array
Anymatch compatible filters...
Example
var recurse = require('./fs-recurse');
recurse('test', function(path, filename, type, cursor){
fs.stat(path + '/' + file, function(err, stats){
cursor();
});
}, function(){
console.log('Done!');
}, [/\.txt$/, 'index.html']);