Permalink
Browse files

Update dump script

  • Loading branch information...
1 parent 53e9479 commit baa8d7e6c5f63cbff74dbe2525543e94a8f2deb8 @danmactough committed Jun 11, 2013
Showing with 9 additions and 9 deletions.
  1. +9 −9 bin/dump.js
View
@@ -2,18 +2,18 @@
/*
* Parse a feed and dump the result to the console
*
- * Usage: node dump.js <feed url or filename>
+ * Usage: curl <feed url> | bin/dump.js
+ * cat <feed file> | bin/dump.js
*
*/
var util = require('util')
- , feedparser = require('../')
- , file = process.argv[2];
+ , FeedParser = require('../');
-if (!file) {
- process.exit(2);
-}
-feedparser.parseFile(file)
+process.stdin.pipe(new FeedParser())
.on('error', console.error)
- .on('complete', function(){
- console.log(util.inspect(arguments, null, 10, true));
+ .on('readable', function() {
+ var stream = this, item;
+ while (item = stream.read()) {
+ console.log(util.inspect(item, null, 10, true));
+ }
});

0 comments on commit baa8d7e

Please sign in to comment.