Skip to content


Subversion checkout URL

You can clone with
Download ZIP
Tree: 02746784bf
Fetching contributors…

Cannot retrieve contributors at this time

82 lines (60 sloc) 1.98 KB


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

dive(directory[, options], action[, complete]);
  • directory is the pathname of a readable directory.
  • options [optional] is an object that defines some of the properties.

    The default options are as follows:

      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. ".gitignore" or
                          //  ".git/HEAD".
      directories: false  // - If set to true, this will call `action` on
                          //   directories, too.
      files: true         // - If set to false, this won't call `action` on
                          //   files any more.
  • action is passed two arguments (err, file) where err is an error or null and file is the pathname of a file.
  • complete [optional] may define a second callback, that is called, when all files have been processed. It takes no arguments.


npm install dive



var dive = require('dive');

dive(process.cwd(), function(err, file) {


All files and a callback in the end:

var dive = require('dive');

dive(process.cwd(), { all: true }, function(err, file) {
  if (err) throw err;
}, function() {

Directories only:

var dive = require('dive');

dive(process.cwd(), { directories: true, files: false }, function(err, dir) {
  if (err) throw err;

Bugs and Issues

If you encounter any bugs or issues, feel free to open an issue at github.


This package is licensed under the MIT license.

Jump to Line
Something went wrong with that request. Please try again.