Skip to content

Commit

Permalink
fixes issue Seneca-CDOT#16 added a parser to parse both atom and rss …
Browse files Browse the repository at this point in the history
…feeds
  • Loading branch information
c3ho committed Nov 8, 2019
1 parent 29a5247 commit 43457f6
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/feed-parser.js
Expand Up @@ -2,16 +2,16 @@ const FeedParser = require('feedparser');
const bent = require('bent');

// feed: url feed
// Accepts a url feed and parses it, on success will
// Accepts a url feed and parses it, on success will return the stream
module.exports = async function(feed){
const feedparser = new FeedParser();
const getStream = bent(feed);

let stream = await getStream('/json.api');
return new Promise((resolve,reject)=>{
stream.pipe(feedparser)
.on('error', rej)
.on('readable', resolve(this))
)
};
}
.on('error', reject)
.on('readable', resolve);
})
};

0 comments on commit 43457f6

Please sign in to comment.