0.6.0 • Published 9 years ago

promising-streams v0.6.0

Weekly downloads
1
License
MIT
Repository
github
Last release
9 years ago

Promising-Streams

Create Streams which utilise promises for their internal methods.

Usage

Readable(options, read)

Readable can be called as a method or instantiated, either way it returns a new instance of a ReadablePromiseStream.

Examples

var readable = require('promising-streams').Readable

var arr = ['a', 'b', 'c', 'd', 'e'];

readable(() => Promise.resolve(arr.shift() || null))
.pipe(someOtherStream);

This basically sets the streams internal _read method to call the supplied read callback. The only difference to regular streams is that the callback is set to __read rather than _read