1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-14 03:30:18 +00:00
musix-oss/node_modules/walkdir/test/comparison/fstream.js

25 lines
474 B
JavaScript
Raw Normal View History

2020-03-03 20:30:50 +00:00
var fstream = require('fstream');
var pipe = fstream.Reader(process.argv[2]||"../");
var count = 0,errorHandler;
pipe.on('entry',function fn(entry){
if(entry.type == "Directory"){
entry.on('entry',fn);
} else if(entry.type == "File") {
count++;
}
entry.on('error',errorHandler);
});
pipe.on('error',(errorHandler = function(error){
console.log('error event ',error);
}));
pipe.on('end',function(){
console.log('end! '+count);
});
//this is pretty slow