Created
August 6, 2013 09:10
-
-
Save lanwin/6162964 to your computer and use it in GitHub Desktop.
Nodejs merging object streams. Here is my current working example. But I dont like it. A MergeStream with one 'end' event would be much better. A sidenode: FeedParser implements node TransformStream and set its objectmode to true so that in the end we stream objects instead buffers. This could be better solved with RxJS. But what I currently don…
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 data = []; | |
exampleFeeds.forEach(function(feedFile) { | |
fs.createReadStream(feedFile) | |
.pipe(new FeedParser()) | |
.on('meta', function(meta) { | |
data.push(meta); | |
if(data.length===exampleFeeds.length){ | |
console.log('done '+data.length); | |
// do something | |
} | |
}); | |
}); |
Thx that works like I expect. I dont know why I dont got this. Ive tried this one https://github.com/felixge/node-combined-stream which dose not work like I am expecting.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
+1