Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

walkdir

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

walkdir - npm Package Compare versions

Comparing version 0.0.8 to 0.0.9

test/ignore-during.js

2

package.json
{
"name": "walkdir",
"description": "Find files simply. Walks a directory tree emitting events based on what it finds. Presents a familliar callback/emitter/a+sync interface. Walk a tree of any depth.",
"version": "0.0.8",
"version": "0.0.9",
"author": "Ryan Day <soldair@gmail.com>",

@@ -6,0 +6,0 @@ "keywords": [

@@ -140,2 +140,15 @@ [![Build Status](https://secure.travis-ci.org/soldair/node-walkdir.png)](http://travis-ci.org/soldair/node-walkdir)

### ignore(path or array of paths)
will not traverse these directories. may be called in the path event handler to ignore dynamically.
```js
var walk = require('walkdir');
var p = require('path');
walk('/',function(path,stat){
// ignore all .git directories.
if(p.basename(path) === '.git') {
this.ignore(path)
}
})
```
### cancel a walk in progress

@@ -142,0 +155,0 @@ ```js

@@ -28,2 +28,3 @@ var EventEmitter = require('events').EventEmitter,

var emitter = new EventEmitter(),
dontTraverse = [],
allPaths = (options.return_object?{}:[]),

@@ -50,2 +51,8 @@ resolved = false,

emitter.ignore = function(path){
if(Array.isArray(path)) dontTraverse.push.apply(dontTraverse,path)
else dontTraverse.push(path)
return this
}
//mapping is stat functions to event names.

@@ -115,2 +122,11 @@ var statIs = [['isFile','file'],['isDirectory','directory'],['isSymbolicLink','link'],['isSocket','socket'],['isFIFO','fifo'],['isBlockDevice','blockdevice'],['isCharacterDevice','characterdevice']];

if(dontTraverse.length){
for(var i=0;i<dontTraverse.length;++i){
if(dontTraverse[i] == path) {
dontTraverse.splice(i,1)
return;
}
}
}
job(1);

@@ -138,2 +154,3 @@ var readdirAction = function(err,files) {

//use same pattern for sync as async api

@@ -140,0 +157,0 @@ if(options.sync) {

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc