A small promise-based wrapper for through2, based on RangerMauve's through2-map-promise
npm install --save through2-promise
var through2 = ;fs;
Or object streams:
var all =fs;
through2-promise([options,] [fn] [, flushFunction])
Creates a transform stream which calls your transforming function,
fn. You can throw within your function to
automatically reject the promise and error-out the stream.
options is the optional object that gets passed into through2.
this is the through2 stream, so you can do
this.push() just like in through2. If you return a Promise, and
the Promise resolves to a value, this value will be written to the stream (just like passing a value to the
callback in through2).
flushFunction() is a function that runs after the source stream has been consumed. It has access to
and also any value returned will be appended to the written results.
through2-promise.obj([options,] [fn] [, flushFunction])
Same as the former, but the stream is created in objectMode.
through2-promise.ctor([options,] [fn] [, flushFunction])
Creates a constructor for your transform stream in case you want to be more efficient.