Skip to content

Commit 754f6bb

Browse files
author
AJ ONeal
committed
allow providing a directory, mark as file or directory
1 parent 908051c commit 754f6bb

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

test/test-walk.js

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,24 @@
22
"use strict";
33

44
var walk = require('../lib/walk').walk
5+
, path = require('path')
6+
, dirname = process.argv[2] || './'
57
, walker
68
;
79

8-
walker = walk('./');
10+
walker = walk(dirname);
11+
12+
walker.on('directory', function (root, stat, next) {
13+
console.log('[d]', path.join(root, stat.name));
14+
next();
15+
});
16+
917
walker.on('file', function (root, stat, next) {
10-
console.log(root, stat.name);
18+
console.log('[f]', path.join(root, stat.name));
1119
next();
1220
});
1321

22+
walker.on('end', function () {
23+
console.log('All Done!');
24+
});
1425
}());

0 commit comments

Comments
 (0)