New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

recurse

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

recurse

Takes a root dir and recursively streams paths

latest
Source
npmnpm
Version
3.0.2
Version published
Maintainers
1
Created
Source

recurse

Takes a root dir and recursively streams paths.

build status dependency status dev dependency status

Example

var recurse = require('recurse');

// recursively write all filetypes except directories:
recurse('.').pipe(process.stdout);

// recursively write js files:
function js(relname, stat) {
  return !stat.isDirectory() && relname.match(/\.js$/)
}
recurse('.', {writefilter: js}).pipe(process.stdout);

// recursively write dirs:
function dir(relname, stat) {
  return stat.isDirectory();
}
recurse('.', {writefilter: dir}).pipe(process.stdout);

// non-recursively write all files:
function none(relname, stat) {
  return false;
}
recurse('.', {recursefilter: none}).pipe(process.stdout);

// recurse into test/ and write js files:
function test(relname, stat) {
  return stat.isDirectory() && ~relname.indexOf('test');
}
recurse('.', {recursefilter: test, writefilter: js}).pipe(process.stdout);

Mehods

var recurse = require('recurse');

var s = recurse(root, opts={})

Return a redable stream of all paths beneath a root directory.

Optionally pass in the following opts:

  • opts.writefilter - custom function for determining whether to write a path to the recurse stream using a opts.writefilter(relname, stat) signature.
  • opts.recursefilter - custom function for determining whether to recurse a path using a opts.writefilter(relname, stat) signature.
  • opts.resolvesymlinks - if set to true symbolic links will be resolved

Compatibility

Node 0.8.x will use the readable-stream module while node 0.10.x and newer will use the core Readable stream class.

Performance

recurse is about an order of magnitude slower than GNU find after a couple of runs on my home directory. See the benchmark for detailed results against other node modules.

License

MIT

Keywords

recursive

FAQs

Package last updated on 10 Sep 2013

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