Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/yorkie/node-stream-simplify

little utility for simplifying your stream, programming more like callback style.
https://github.com/yorkie/node-stream-simplify

Last synced: 5 days ago
JSON representation

little utility for simplifying your stream, programming more like callback style.

Awesome Lists containing this project

README

        

# node-stream-simplify

Little utility for simplifying your stream, programming more like callback style.

Sometimes, you just wanna send a simple net data to the service, then you provide a callback that receive the data. This module could help you to do then.

The difference is more like the `fs.read` and `fs.createReadStream`, so you could use my module to monitor `fs.read` by using `fs.createReadStream`, actually `stream-simplify` should be used for streams that only provide an event-drivern api, like `net` or `tls`.

### Installation
```
$ npm install stream-simplify
```

### Example
```js
simplify(fs.createReadStream('./example.txt'), option, function(err, data) {
// TODO
})
```

### Option

* timeout: the max secound that callback must be invoked.

* depth: the time that you wanna triggered the `data`event.

### License

MIT