Skip to content

Instantly share code, notes, and snippets.

@drguildo
Last active June 20, 2017 10:41
Show Gist options
  • Save drguildo/e719cac1910d508e07e24df79e79cfb4 to your computer and use it in GitHub Desktop.
Save drguildo/e719cac1910d508e07e24df79e79cfb4 to your computer and use it in GitHub Desktop.
Error.stackTraceLimit = Infinity;
const request = require("request");
const FeedParser = require("feedparser");
const feedUrl = "https://news.ycombinator.com/rss";
function foo() {
let feedparser = new FeedParser();
request(feedUrl).pipe(feedparser);
feedparser.on("readable", function () {
const stream = this; // `this` is `feedparser`, which is a stream
let item;
while (item = stream.read()) {
console.log("[%s] %s", item.pubdate, item.title || item.description);
}
});
}
foo();
foo();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment