index.js
function srcStream(stream) {
  var pass = through.obj();
  pass.setMaxListeners(0);

  var outputstream = duplexify.obj(pass, ms(stream, pass));
  outputstream.setMaxListeners(0);

  var isReading = false;
  outputstream.on('pipe', function (src) {
    isReading = true;
    src.on('end', function () {
      isReading = false;
      outputstream.end();
    });
  });

  stream.on('end', function () {
    if (!isReading) {
      outputstream.end();
    }
  });

  return outputstream;
}
function srcStream(stream) {
  var pass = through.obj();
  pass.setMaxListeners(0);

  var outputstream = duplexify.obj(pass, ms(stream, pass));
  outputstream.setMaxListeners(0);

  var isReading = false;
  outputstream.on('pipe', function (src) {
    isReading = true;
    src.on('end', function () {
      isReading = false;
      outputstream.end();
    });
  });

  stream.on('end', function () {
    if (!isReading) {
      outputstream.end();
    }
  });

  return outputstream;
}
function srcStream ( stream ) { var pass = through . obj ( ) ; pass . setMaxListeners ( 0 ) ; var outputstream = duplexify . obj ( pass , ms ( stream , pass ) ) ; outputstream . setMaxListeners ( 0 ) ; var isReading = false ; outputstream . on ( 'pipe' , function ( src ) { isReading = true ; src . on ( 'end' , function ( ) { isReading = false ; outputstream . end ( ) ; } ) ; } ) ; stream . on ( 'end' , function ( ) { if ( ! isReading ) { outputstream . end ( ) ; } } ) ; return outputstream ; }
Wrap a source stream to passthrough any data
that's being written to it.

```js
var src = require('src-stream');

// wrap something that returns a readable stream
var stream = src(plugin());

fs.createReadStream('./package.json')
.pipe(stream)
.on('data', console.log)
.on('end', function () {
console.log();
console.log('Finished');
console.log();
});
```

@param  {Stream} `stream` Readable stream to be wrapped.
@return {Stream} Duplex stream to handle reading and writing.
@api public
Wrap a source stream to passthrough any data that s being written to it .