node package manager


Analyze a directory substructure and return it as an object.

Traverses a given directory and builds a tree from its structure.


npm install dirscanner


dirscanner(target, ignore, start);

  • target

    The path to scan.

  • ignore

    Optional array of regexp objects. Any basename matching this pattern will not be scanned. Might be expanded to include full paths in the future.

  • start

    Third optional argument, pass false if you don't want the dirscanner to start immediately.

Start scan in target directory.

var dirscanner = require('dirscanner');
var ds = dirscanner('/path/to/directory/to/scan');
ds.on('done', function (root) {
  console.log('Scan complete\nHere\'s the root obejct:', root);