Eventual Pony
Process streams with generators and co.
- Write code and handle exceptions in sync style.
- Stream2 readables, writables and transforms.
- Has
pipe()
ing and backpressure. - Works natively on io.js. Works on node with
--harmony
. - Backed by co so do any co stuff.
- Great name.
Install
npm install eventual-pony
Silly example
var pony = var upperify = pony fs
API Documentation
pony.writable([opts], genFunc(input))
Create a writable stream.
- opts - Options object passed to native Writable constructor. (optional)
- input([encoding]) - Returns yieldable for next available upstream value. If not in object mode and
encoding
is provided, produces string, otherwise a buffer.
// consume a stream of numbers to produce a sumvar sum = 0pony
pony.readable([opts], genFunc(output))
Create a readable stream.
- opts - Options object passed to native Readable constructor. (optional)
- output(value, [encoding]) - Sends a value downstream. Returns a yieldable that resolves more or less quickly depending on how fast downstream is accepting data.
// stream of fibonacci numberspony
pony.transform([opts], genFunc(input, output))
Create a transform stream.
- opts - Options object passed to native Transform constructor. (optional)
- input([encoding]) - Returns a yieldable on next available upstream value. If not in object mode and
encoding
is provided, produces string, otherwise a buffer. - input.ended() - Once this returns
true
the input is ended, sooutput()
any remaining stuff. - output(value, [encoding]) - Sends a value downstream. Returns a yieldable that resolves more or less quickly depending on how fast downstream is accepting data.
// dedupe an object streamupstream
Change log
- 0.0.2 - Updated header comments in code files.
- 0.0.1 - Added a repository field in package.json.
- 0.0.0 - First version. Has readables, writables and transforms.
Why "Eventual Pony"?
If you're good little boys and girls, eventually you'll get a pony.