Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

synchronous version of dive

branch: master

0.2.1

latest commit 893cae9cd8
Paul Vorbach authored April 17, 2014
Octocat-spinner-32 test Add filter option November 12, 2011
Octocat-spinner-32 LICENSE.mkd Initial commit September 20, 2011
Octocat-spinner-32 README.mkd Add filter option November 12, 2011
Octocat-spinner-32 diveSync.js Define defaultConf in function diveSync() April 17, 2014
Octocat-spinner-32 package.json 0.2.1 April 17, 2014
README.mkd

diveSync is a tiny module for node that is able to recursively walk („dive“) a directory tree. diveSync is the synchronous version of dive.

Usage

var diveSync = require("diveSync");

diveSync(process.cwd(), function(err, file) {
  if (err) throw err;

  console.log(file);
});

This will list all files in your current working directory. The function call blocks until all files are handled.

You may also apply options to the function call.

dive(dir[, opt], action);

The default options are

{
  recursive: true,    // - If set to false, this will ignore subdirectories.
  all: false,         // - If set to true, this will show "dot files" and
                      //   files in "dot directories", e.g. ".gitinore" or
                      //   ".git/HEAD".
  directories: false  // - If set to true, this will show directories, too.
  filter: function filter(path, dir) { return true; }
                      // - Function that returns true for all paths that should
                      //   not be ignored.
}

filter takes two arguments (path, dir). path defines the path to file in the file system. dir is true, if path is a directory, otherwise false.

You can use this to filter out specific files or directories by their pathname.

Something went wrong with that request. Please try again.