Skip to content
This repository has been archived by the owner on Feb 8, 2023. It is now read-only.

Commit

Permalink
update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
fengmk2 committed Sep 21, 2012
1 parent a6772a1 commit 7e85916
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
language: node_js
node_js:
- 0.4
- 0.6
- 0.8
- 0.9
22 changes: 11 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,21 @@ The lost dir util tools. Handle dir and file in Event.

## Install

```
```bash
$ npm install ndir
```

require `ndir`

```
```bash
var ndir = require('ndir');
```

## Walk dir: ndir.walk()

callback mode:

```
```js
ndir.walk('./', function onDir(dirpath, files) {
console.log(' * %s', dirpath);
for (var i = 0, l = files.length; i < l; i++) {
Expand All @@ -38,7 +38,7 @@ ndir.walk('./', function onDir(dirpath, files) {

event mode:

```
```js
var walker = ndir.walk('./');
walker.on('dir', function(dirpath, files) {
console.log(' * %s', dirpath);
Expand All @@ -61,7 +61,7 @@ walker.on('end', function() {

Copy file, auto create target file parent dir if it not exists.

```
```js
ndir.copyfile(fromfile, tofile, function(err) {
if (err) {
throw err;
Expand All @@ -74,7 +74,7 @@ ndir.copyfile(fromfile, tofile, function(err) {

Make dir, equal `$ mkdir -p dirname` .

```
```js
ndir.mkdir(dirname, function(err) {
if (err) {
throw err;
Expand All @@ -87,7 +87,7 @@ ndir.mkdir(dirname, function(err) {

If you want to read a file line by line, `ndir.LineReader` will help you easy way to do that.

```
```js
var ndir = require('ndir');
var assert = require('assert');

Expand All @@ -106,27 +106,27 @@ ndir.createLineReader('./test/access.log').on('line', function(line) {

First install the dev dependencies to install all the example / test suite deps:

```
```bash
$ npm install -d
```

then run whichever tests you want:

```
```bash
$ node example/listdir.js example
```

## Running Tests

To run the test suite first invoke the following command within the repo, installing the development dependencies:

```
```bash
$ npm install
```

then run the tests:

```
```bash
$ make test
```

Expand Down

0 comments on commit 7e85916

Please sign in to comment.