Home

Awesome

explorer Build Status Dependency Status

Explore directories in various ways.

Main function: explorer.explore (root[, options])

explore returns an EventEmitter.

It recursively goes through the directories under root, and while doing so, emits various events.

Events emitted

Notes

Convenience functions

explorer.getFiles (root[, options], cb)

cb gets called with (err, filePaths).

explorer.getDirectories (root[, options], cb)

cb gets called with (err, directoryPaths).

explorer.countFiles (root[, options], cb)

cb gets called with (err, numFiles).

explorer.countDirectories (root[, options], cb)

cb gets called with (err, numDirectories).

explorer.getDirectoryTree (root[, options], cb)

cb gets called with (err, tree). tree is the root node of a tree structure where each node has a label (string) and nodes (array) property. This can be given to archy as is.

explorer.getNamespaceObject (root[, options], cb)

cb gets called with (err, nsObject). nsObject is the root node of a namespace structure where each node has properties named after the name subdirectories it contains, the value being another directory node.

This is useful when you use a hierarchical global namespace for your application components and the folder structure of your application closely matches the namespace you use. You may want to recursively change the property names with a tool like tower-strcase or change-case.

Options

Each function takes an optional options object as second-last argument. Currently, the following options are available:

Boolean, defaulting to false

Other

Credits

The initial structure of this module was generated by Jumpstart, using the Jumpstart Black Coffee template.

The interface for the explore function - on which the other functions rely - was inspired by node-walk by AJ ONeal

License

explorer is released under the MIT License.
Copyright (c) 2013 Meryn Stol