scan-fs

Scans the file system.

scan-fs

Scans the file system in nodejs

在nodejs环境下扫描文件系统的工具。 例子:


var scanFS = require('scan-fs' ).create();
//scanFS.exclude(__filename); 
//scanFS.exclude(/dir.*/); 
scanFS.exclude('*dir*');
/*scanFS.exclude(['*index.js']);
 scanFS.exclude(/.*index.js$/);
 scanFS.exclude(new RegExp(/.*index.js$/));*/
 
scanFS.listeners({
    'file'function(filePatheOpts){
        console.log('File: ' + filePath);
    },
    'directory'function(patheOpts){
        console.log('Directory: ' + path);
    },
    'error'function(err){
        console.log('err:' , err);
    },
    'complete'function(fileCountdirCount){
        console.log('complete: ' + fileCount + ' files, ' + dirCount + ' directory')
    },
    'root'function(patheventArgs){
        console.log('root: ' + path);
    },
    'path'function(patheOpts){
        console.log('path: ' + path);
    }
    }).setRecursive(true).scan('/home/lg/workspace/nodejs');