Permalink
Browse files

Update README

  • Loading branch information...
1 parent 0960609 commit 6018909839d1c79da5009856d5762410cb47accc @pvorb committed Feb 10, 2012
Showing with 28 additions and 4 deletions.
  1. +28 −4 README.mkd
View
@@ -3,23 +3,25 @@ a tiny module for node that is able to recursively walk (_„dive“_) a
directory tree. **dive** is the asynchronous version of
[diveSync](//github.com/pvorb/node-diveSync).
-```javascript
+```js
dive(directory[, options], action[, complete]);
```
* `directory` is the pathname of a readable directory.
-* `options [optional]` is an object that defines some of the properties.
+* `options` [optional] is an object that defines some of the properties.
The default options are as follows:
- ```javascript
+ ```js
{
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
@@ -35,7 +37,18 @@ npm install dive
## Usage
-```javascript
+Default:
+
+```js
+var dive = require('dive');
+
+dive(process.cwd(), function(err, file) {
+
+});
+
+All files and a callback in the end:
+
+```js
var dive = require('dive');
dive(process.cwd(), { all: true }, function(err, file) {
@@ -46,6 +59,17 @@ dive(process.cwd(), { all: true }, function(err, file) {
});
```
+Directories only:
+
+```js
+var dive = require('dive');
+
+dive(process.cwd(), { directories: true, files: false }, function(err, dir) {
+ if (err) throw err;
+ console.log(dir);
+});
+```
+
## Bugs and Issues
If you encounter any bugs or issues, feel free to open an issue at

0 comments on commit 6018909

Please sign in to comment.