Walk through directories asynchronously, with callback on each file/folder and ignore option
npm install fs-recurse
recurse(String path, Function callback, Function done, Array ignore);
-
path String
Path in which you want to recurse
-
callback Function
Receives four arguments :
-
path String
current path -
filename String
current file name -
type 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...
var recurse = require('./fs-recurse');
recurse('test', function(path, filename, type, cursor){
fs.stat(path + '/' + file, function(err, stats){
cursor();
// Do async operation on files ...
});
}, function(){
console.log('Done!');
}, [/\.txt$/, 'index.html']);
// *.txt and index.html will be ignored