Skip to content

Instantly share code, notes, and snippets.

@iarna
Created July 29, 2014 05:40
Show Gist options
  • Save iarna/78aebb51f31cce7cd49b to your computer and use it in GitHub Desktop.
Save iarna/78aebb51f31cce7cd49b to your computer and use it in GitHub Desktop.
var stream = require('stream');
var DuplexCombination = require('duplex-combination');
function dosomething() {
var input = new stream.PassThrough();
var output = new stream.PassThrough();
var combined = new DuplexCombination(output,input)
output.write('two');
input.pipe(output);
return combined;
}
var source = new stream.PassThrough()
source.pipe(dosomething()).pipe(process.stdout)
source.write('one')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment