🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
DemoInstallSign in
Socket

directorywalker

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

directorywalker

Walk directories recursively and event based.

1.0.2
latest
Source
npm
Version published
Weekly downloads
3
Maintainers
1
Weekly downloads
 
Created
Source

DirectoryWalker for NodeJS

Build Status

Walk directories recursively and event based.

Usage

npm install --save directorywalker

Example:

var DirectoryWalker = require('directorywalker');
var walker = new DirectoryWalker({ /* optional options object */ });

walker.on('file', function (file) { console.log(file); });

walker.walk(__dirname);

API

Options

fileFilter: function (path, callback(err, boolean))

The fileFilter is invoked every time a file is encountered. If the result (gathered asynchronously, the callback takes an error as its first argument and the verdict as its second argument) is trueish the file event will be emitted for the given file.

dirFilter: function (path, callback(err, boolean))

The dirFilter is invoked every time a dir is encountered. If the result (gathered asynchronously, the callback takes an error as its first argument and the verdict as its second argument) is trueish the dir event will be emitted for the given file. If the event is not trueish, the event will not be emitted and the directory will not be descended into.

Events

walker.on('file', function (path) { ... })

Emitted each time a file is encountered and accepted by the fileFilter (if any).

walker.on('dir', function (path) { ... })

Emitted each time a directory is encountered and accepted by the dirFilter (if any).

walker.on('error', function (path, err) { ... })

Emitted each time an error occurs (for example when statting a file, invoking a filter, ...).

walker.on('entry', function (path) { ... })

Emitted each time a directory entry (be it a file, a directory, anything) is encountered.

walker.on('stats', function (path, stats) { ... })

Emitted each time a directory entry is statted. The event also carries the stats for that directory entry.

Keywords

filesystem

FAQs

Package last updated on 27 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts