Socket
Socket
Sign inDemoInstall

walker

Package Overview
Dependencies
2
Maintainers
0
Versions
11
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

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() {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc