Created
November 14, 2015 16:41
-
-
Save enricostano/da534cc2055fd4a91cae to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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