drain an object stream and wrap it in a promise
Think of it as a streaming version of Q.all. Pipe a stream of promises into it and await them all to resolve, or reject on any error.
var charybdis =var readStream = // from somewherevar done =done
In pseudo code, lets say we want to stream a log file and validate a resource in the db:
charybdis := handler?: Promise)WriteStream & Promise<Stats>type Stats :objects: Numberoperations: Numberstart: TimestampstreamEnd: Timestampend: Timestampemits:inEnd: Event<void> when the ReadStream endstick: Event<Stats> periodically as processing is happeningresolves:when each of the promises is resolvedrejected:when any of of the promises is rejected or on stream error
promiser is a function called on every item in the read stream.
If it returns a
Promise, that is considered to be an operation.
Once all input streams have ended and all operations have been resolved,
the aggregate promise will be resolved.
$ npm install charybdis
From package root:
$ npm install $ npm test
MIT. (c) MMXIII AgileMD firstname.lastname@example.org. See LICENSE.md