-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtestScanFS.js
More file actions
executable file
·44 lines (40 loc) · 1006 Bytes
/
Copy pathtestScanFS.js
File metadata and controls
executable file
·44 lines (40 loc) · 1006 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#!/usr/bin/env node
/**
*
* User: lg
* Date: 8/16/13
* Time: 11:47 PM
* Version: v0.0.1
*/
var scanFS = require('./scan-fs' ).create()
, scanPath = process.argv.slice(2);
if(scanPath && scanPath.length > 0){
//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(filePath, eOpts){
console.log('File: ' + filePath);
},
'directory': function(path, eOpts){
console.log('Directory: ' + path);
},
'error': function(err){
console.log('err:' , err);
},
'complete': function(fileCount, dirCount){
console.log('complete: ' + fileCount + ' files, ' + dirCount + ' directory')
},
'root': function(path, eOpts){
console.log('root: ' + path);
},
'path': function(path, eOpts){
console.log('path: ' + path);
}
}).setRecursive(true).scan(scanPath[0]);
} else {
console.log('Usage: node testScanFS.js path');
}