Skip to content

Instantly share code, notes, and snippets.

@enricostano
Created November 14, 2015 16:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save enricostano/da534cc2055fd4a91cae to your computer and use it in GitHub Desktop.
Save enricostano/da534cc2055fd4a91cae to your computer and use it in GitHub Desktop.
var streamPair = require('stream-pair');
var Interactive = require('multistream-select').Interactive;
var Select = require('multistream-select').Select
var pair = streamPair.create();
var msi = new Interactive();
var mss = new Select()
mss.handle(pair.other);
mss.addHandler('/xxx/', function(ds) {
ds.on('data', function(chunk) {
console.log('que si');
});
ds.on('end', function() {
ds.end();
});
});
mss.addHandler('/dog/', function(ds) {
ds.on('data', function(chunk) {
console.log(chunk.toString());
console.log('w');
});
ds.on('end', function() {
ds.end();
});
});
msi.handle(pair, function() {
console.log('hola')
msi.ls(function(err, result) {
if (err) {
return console.log(err)
}
console.log('results: ', result);
});
msi.select('/dog/', function(err, ds) {
if (err) {
return console.log(err)
}
ds.write('woff');
ds.end();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment