Skip to content

Commit

Permalink
fix the readme
Browse files Browse the repository at this point in the history
  • Loading branch information
tblobaum committed Jul 13, 2012
1 parent 7d2885e commit b5fbea0
Showing 1 changed file with 20 additions and 6 deletions.
26 changes: 20 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,24 @@
# redis-stream

Create readable/writeable/pipeable [api compatible streams](http://nodejs.org/api/streams.html) from redis commands.

[![Build Status](https://secure.travis-ci.org/tblobaum/redis-stream.png)](http://travis-ci.org/tblobaum/redis-stream)

# Example

In the `example` directory there are various streaming examples.

```js

In the `example` directory there are various ways to use `redis-stream` -- such as creating a stream from the redis `monitor` command.

``` js
var Redis = require('redis-stream')
, client = new Redis(6379, 'localhost')

require('http')
.createServer(function (request, response) {
var redis = client.stream()
redis.pipe(Redis.es.join('\r\n')).pipe(response)
redis.write('monitor')
})
.listen(3000)
```

# Methods
Expand All @@ -22,7 +32,7 @@ var Redis = require('redis-stream')
Return an object that streams can be created from with the `port`, `host`, and `database` options -- `port` defaults to `6379`, `host` to `localhsot` and `database` to `0`.

## client.stream([arg1] [, arg2] [, argn])
Return a [node.js api compatible stream](http://nodejs.org/api/streams.html) that is readable, writeable, and can be piped. All calls to `write` on this stream will be prepended with the optional arguments passed to `client.stream`
Return an instance of that is readable, writeable, and can be piped. All calls to `write` on this stream will be prepended with the optional arguments passed to `client.stream`

Create a streaming instance of rpop:

Expand Down Expand Up @@ -52,7 +62,7 @@ Return a stream that can be piped to to transform an `hmget` or `hgetall` stream
It's possible to interact directly with the command parser that transforms a stream into valid redis data stream

``` js
var Redis = require('../')
var Redis = require('redis-stream')
, redis = new Redis(6379, 'localhost')
, stream = redis.stream()

Expand All @@ -69,6 +79,10 @@ stream.end()

`npm install redis-stream`

# Tests

`npm install -g tap && npm test`

# License

(The MIT License)
Expand Down

0 comments on commit b5fbea0

Please sign in to comment.