Skip to content

Commit

Permalink
Revised README
Browse files Browse the repository at this point in the history
  • Loading branch information
pvorb committed Sep 4, 2012
1 parent 0274678 commit b503450
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 17 deletions.
2 changes: 1 addition & 1 deletion LICENSE.mkd → LICENSE
@@ -1,4 +1,4 @@
Copyright © 2011-2012 Paul Vorbach <paul@vorb.de>
Copyright © 2011-2012 Paul Vorbach

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
Expand Down
52 changes: 36 additions & 16 deletions README.mkd → README.md
@@ -1,18 +1,19 @@
# dive

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).

```js
~~~ javascript
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:

```js
~~~ javascript
{
recursive: true, // - If set to false, this will ignore subdirectories.
all: false, // - If set to true, this will show "dot files" and
Expand All @@ -23,32 +24,31 @@ dive(directory[, options], action[, complete]);
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.

## Installation

```bash
npm install dive
```
npm install dive

## Usage

Default:

```js
~~~ javascript
var dive = require('dive');

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

});
~~~

All files and a callback in the end:

```js
~~~ javascript
var dive = require('dive');

dive(process.cwd(), { all: true }, function(err, file) {
Expand All @@ -57,25 +57,45 @@ dive(process.cwd(), { all: true }, function(err, file) {
}, function() {
console.log('complete');
});
```
~~~

Directories only:

```js
~~~ javascript
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
[github](//github.com/pvorb/node-dive/issues).
If you encounter any bugs or issues, feel free to
[open an issue at github](//github.com/pvorb/node-dive/issues) or send me an
email to <paul@vorb.de>. I also always like to hear from you, if you’re using my
code.

## License

This package is licensed under the
[MIT license](http://vorb.de/license/mit.html).
(The MIT License)

Copyright © 2011-2012 Paul Vorbach

Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the “Software”), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

0 comments on commit b503450

Please sign in to comment.