lib-stream-future

duplex stream that can be fulfilled in the future

lib-stream-future

npm install --save lib-stream-future
var future = require('lib-stream-future');
 
var f = future();
 
f.pipe(process.stdout);
 
setTimeout(function () {
  someStream.pipe(f);
}, 1000);
var future = require('lib-stream-future');
 
var f = future();
 
process.stdin.pipe(f);
 
setTimeout(function () {
  f.pipe(someSink);
}, 1000);
function holla(opts) {
  var f = future();
  var req = http.request(opts, function (res) {
    f.setReadable(res);
  });
  f.setWritable(req);
  return f;
}
 
A.pipe(holla('http://example.com/my/API')).pipe(B);