0.0.6 • Published 9 years ago
fs-recurse v0.0.6
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();
// Do async operation on files ...
});
}, function(){
console.log('Done!');
}, [/\.txt$/, 'index.html']);
// *.txt and index.html will be ignored