danmactough / node-feedparser

Robust RSS, Atom, and RDF feed parsing in Node.js
Other
1.97k stars 192 forks source link

Transform pipe to stdout #204

Closed jonathan-chin closed 7 years ago

jonathan-chin commented 7 years ago

hey,

pardon my ignorance; I don't have much experience writing or coding with NodeJS streams. I want to use feedparser to pull a particular field from an rss feed (the uid the site generates for each article) and pipe that to another process. how can I do that?

I've tried using stream.emit and stream.write but I keep getting TypeError: Invalid data, chunk must be a string or buffer, not object

danmactough commented 7 years ago

Hi, @jonathan-chin. Here's a great demo that should help you get started if you're still struggling.

bitwombat commented 4 years ago

The demo doesn't do what OP wants. It uses a callback to send all the accumulated data.

What OP (and I) am trying to do is something like:

fs.createReadStream('rss.xml').pipe(feedParser).pipe(process.stdout)   

Because feedparser is a transform stream, I keep thinking this is possible, but I can't figure out how.