Last active
August 29, 2015 14:03
-
-
Save chilijung/7818f33b074b693b71e7 to your computer and use it in GitHub Desktop.
testing various streaming library
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
node_modules |
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 csvBuffStream = require('csv-multibuffer-stream'); | |
var fs = require('fs'); | |
var wstream = fs.createWriteStream('output'); | |
var encoder = csvBuffStream() | |
fs.createReadStream('./test.csv').pipe(encoder).pipe(wstream); |
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 multiplex = require('multiplex') | |
var plex1 = multiplex() | |
var stream1 = plex1.createStream() | |
var stream2 = plex1.createStream() | |
var plex2 = multiplex(function onStream(stream, id) { | |
stream.on('data', function(c) { | |
console.log('data', id, c.toString()) | |
}) | |
}) | |
plex1.pipe(plex2) | |
stream1.write(new Buffer('stream one!')) | |
stream2.write(new Buffer('stream two!')) |
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
test1 test2 test3 | |
1 2 3 |
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
test1 | test2 | test3 | |
---|---|---|---|
1 | 2 | 3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment