npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

rss-feed-emitter-headers

v1.0.0

Published

Super RSS News Feed aggregator written in Node.js and ES6 by Filipe Deschamps

Downloads

4

Readme

USE THE OFFICIAL VERSION, THIS IS A PERSONAL VERSION.

Tutorial

This is a fully functional module, but its source code and repository are also a super complete tutorial, covering:

  1. What to do first when creating a module from scratch
  2. How to manage your module in Github and npm
  3. ~~How to transpile your ES6 code into ES5~~ this went away in v3
  4. How to create automated unit and integration tests
  5. How to integrate them with Travis CI and make the build break if tests didn't pass
  6. How to automatically test your module against various versions of Node.js
  7. How to setup a code coverage tool and keep 100% coverage
  8. How to integrate the coverage results with Coveralls
  9. How to configure linting tools to make your code base consistent
  10. How to deploy to Github and npm with tags and releases

If you're afraid to read the source code of the modules you use or to create your first module, this is the best chance you have to break this barrier :)

Start here

Features

  • Supports Node.js 8.x up through the current version of node.js
  • Supported Node.js 4.x, 5.x, 6.x, and 7.x until rss-feed-emitter version 2.0.1
  • Supported Node.js 0.10.x and 0.12.x until rss-feed-emmiter version 1.0.7
  • 100% code coverage with unit and integration tests
  • Simple interface
  • Automatically manages feed history memory
  • Written in ES6
  • Special thanks to @TobiTenno for the complete rewrite!

Usage

Install

$ npm install rss-feed-emitter

Creating an instance

const RssFeedEmitter = require('rss-feed-emitter');
const feeder = new RssFeedEmitter();

Changing the user agent for requests

const feeder = new RssFeedEmitter({ userAgent: 'Your UA string' });

Adding feeds

feeder.add({
  url: 'http://www.nintendolife.com/feeds/news',
  refresh: 2000
});

Default refresh value is 60 seconds

You can also add multiple at once by either providing an array of urls for the url field:

feeder.add({
  url: ['http://www.nintendolife.com/feeds/news', 'http://feeds.bbci.co.uk/news/rss.xml' ],
  refresh: 2000
});

or by passing multiple configs:

feeder.add({
  url: 'http://www.nintendolife.com/feeds/news',
  refresh: 2000
}, {
  url: 'http://feeds.bbci.co.uk/news/rss.xml',
  refresh: 5000
});

Listening to new items

feeder.on('new-item', function(item) {
  console.log(item);
})

you can also override the default 'new-item' event name with a new value of your choice by providing the event name in the feed config.

feeder.add({
  url: 'http://www.nintendolife.com/feeds/news',
  refresh: 2000,
  eventName: 'nintendo'
});

feeder.on('nintendo', function(item) {
  console.log(item);
});

Ignoring the first load of items

const feeder = new RssFeedEmitter({ skipFirstLoad: true });

feeder.add({
  url: 'http://www.nintendolife.com/feeds/news',
  refresh: 2000,
  eventName: 'nintendo'
});

// this item will only be from the new items, not from old items.
feeder.on('nintendo', function(item) {
  console.log(item);
});

Adding an 'error' handler

Handle error events by printing to console. This handler is needed to prevent unhandled exceptions from crashing the processes.

feeder.on('error', console.error);

Listing all feeds in the instance

The list is now an ES6 getter to make the field a bit more plain to access.

feeder.list;

Removing a single feed

feeder.remove('http://www.nintendolife.com/feeds/news');

Destroying feed instance

feeder.destroy();

This will remove all feeds from the instance

Contributors

| @TobiTenno | | :---: |

Author

| @filipedeschamps | | :---: |