walker
Advanced tools
Comparing version 1.0.0 to 1.0.1
44
index.js
@@ -46,9 +46,9 @@ module.exports = Walker | ||
*/ | ||
Walker.prototype.go = function(target) { | ||
Walker.prototype.go = function(entry) { | ||
var that = this | ||
this._pending++ | ||
fs.lstat(target, function(er, stat) { | ||
fs.lstat(entry, function(er, stat) { | ||
if (er) { | ||
that.emit('error', er, target, stat) | ||
that.emit('error', er, entry, stat) | ||
that.doneOne() | ||
@@ -59,8 +59,8 @@ return | ||
if (stat.isDirectory()) { | ||
if (!that._filterDir(target, stat)) { | ||
if (!that._filterDir(entry, stat)) { | ||
that.doneOne() | ||
} else { | ||
fs.readdir(target, function(er, files) { | ||
fs.readdir(entry, function(er, files) { | ||
if (er) { | ||
that.emit('error', er, target, stat) | ||
that.emit('error', er, entry, stat) | ||
that.doneOne() | ||
@@ -70,6 +70,6 @@ return | ||
that.emit('entry', target, stat) | ||
that.emit('dir', target, stat) | ||
that.emit('entry', entry, stat) | ||
that.emit('dir', entry, stat) | ||
files.forEach(function(part) { | ||
that.go(path.join(target, part)) | ||
that.go(path.join(entry, part)) | ||
}) | ||
@@ -80,27 +80,27 @@ that.doneOne() | ||
} else if (stat.isSymbolicLink()) { | ||
that.emit('entry', target, stat) | ||
that.emit('symlink', target, stat) | ||
that.emit('entry', entry, stat) | ||
that.emit('symlink', entry, stat) | ||
that.doneOne() | ||
} else if (stat.isBlockDevice()) { | ||
that.emit('entry', target, stat) | ||
that.emit('blockDevice', target, stat) | ||
that.emit('entry', entry, stat) | ||
that.emit('blockDevice', entry, stat) | ||
that.doneOne() | ||
} else if (stat.isCharacterDevice()) { | ||
that.emit('entry', target, stat) | ||
that.emit('characterDevice', target, stat) | ||
that.emit('entry', entry, stat) | ||
that.emit('characterDevice', entry, stat) | ||
that.doneOne() | ||
} else if (stat.isFIFO()) { | ||
that.emit('entry', target, stat) | ||
that.emit('fifo', target, stat) | ||
that.emit('entry', entry, stat) | ||
that.emit('fifo', entry, stat) | ||
that.doneOne() | ||
} else if (stat.isSocket()) { | ||
that.emit('entry', target, stat) | ||
that.emit('socket', target, stat) | ||
that.emit('entry', entry, stat) | ||
that.emit('socket', entry, stat) | ||
that.doneOne() | ||
} else if (stat.isFile()) { | ||
that.emit('entry', target, stat) | ||
that.emit('file', target, stat) | ||
that.emit('entry', entry, stat) | ||
that.emit('file', entry, stat) | ||
that.doneOne() | ||
} else { | ||
that.emit('error', UnknownFileTypeError(), target, stat) | ||
that.emit('error', UnknownFileTypeError(), entry, stat) | ||
that.doneOne() | ||
@@ -107,0 +107,0 @@ } |
{ | ||
"name": "walker", | ||
"description": "A simple directory tree walker.", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"author": "Naitik Shah <n@daaku.org>", | ||
@@ -6,0 +6,0 @@ "keywords": ["utils", "fs", "filesystem"], |
@@ -40,4 +40,4 @@ walker | ||
}) | ||
.on('error', function(er, target, stat) { | ||
console.log('Got error ' + er + ' on target ' + target) | ||
.on('error', function(er, entry, stat) { | ||
console.log('Got error ' + er + ' on entry ' + entry) | ||
}) | ||
@@ -44,0 +44,0 @@ .on('end', function() { |
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
0
5245