Skip to content
Browse files

[docs] moar docs! (installation and usage)

  • Loading branch information...
1 parent fceb0fd commit 1b71638fef1722b3640397ad78b98570f94a50b9 @mmalecki committed Sep 18, 2011
Showing with 20 additions and 1 deletion.
  1. +20 −1 README.md
View
21 README.md
@@ -7,12 +7,31 @@ ngrep does what grep does, but asynchronously. It was inspired by @AvianFlu's
[ncp](https://github.com/AvianFlu/ncp), which you should be already using.
## Installation
-It's on [npm](http://search.npmjs.org/#/ngrep)! `npm install ngrep`.
+
+### As an executable
+It's on [npm](http://search.npmjs.org/#/ngrep)! `npm install -g ngrep`.
+
+In some cases (e.g. if your node installation is system-wide), you will need to
+`sudo npm install -g ngrep`.
+
+### As a library
+ngrep is so cool that you can use it in your application! In this case just
+add it as a dependency or `npm install ngrep` in your app's directory.
## Usage
+
+### As an executable
To grep directory `dir` for string `foo`: `ngrep foo dir` (it couldn't get
any simpler than that).
It can also grep files, but this is just slower than regular grep:
`ngrep foo file`.
+### As a library
+To grep directory `dir` for RegExp `/foo/g`:
+
+ var ngrep = require('ngrep');
+ ngrep(/foo/g, 'dir', function (result) {
+ console.log(result.file + ': ' + console.context);
+ });
+

0 comments on commit 1b71638

Please sign in to comment.
Something went wrong with that request. Please try again.