allow providing a directory, mark as file or directory

This commit is contained in:
AJ ONeal 2014-01-26 19:08:15 -07:00
父節點 908051c694
當前提交 754f6bb9c4
共有 1 個文件被更改,包括 14 次插入3 次删除

查看文件

@ -2,13 +2,24 @@
"use strict";
var walk = require('../lib/walk').walk
, path = require('path')
, dirname = process.argv[2] || './'
, walker
;
walker = walk('./');
walker.on('file', function (root, stat, next) {
console.log(root, stat.name);
walker = walk(dirname);
walker.on('directory', function (root, stat, next) {
console.log('[d]', path.join(root, stat.name));
next();
});
walker.on('file', function (root, stat, next) {
console.log('[f]', path.join(root, stat.name));
next();
});
walker.on('end', function () {
console.log('All Done!');
});
}());