
Product
Introducing Tier 1 Reachability: Precision CVE Triage for Enterprise Teams
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
FeedSub subscribes to a remote RSS/Atom/JSON feed and notifies you of any new items it reads.
It works by checking the feed every once in a while, comparing the date of the document via a conditional GET if supported. Otherwise it looks for a date tag in the feed. If it's the same as the last date, it stops downloading it and parsing the xml/json. If it's an updated document, then it looks through it top to bottom taking note of all the new items. Once it finds something it has already read, it stops downloading and parsing the document.
const FeedSub = require('feedsub');
let reader = new FeedSub('http://rss.cnn.com/rss/cnn_latest.rss', {
interval: 10 // Check feed every 10 minutes.
});
reader.on('item', (item) => {
console.log('Got item!');
console.dir(item);
});
reader.start();
Creates a new instance of FeedSub. options
defaults to.
{
// Number of minutes to wait between checking the feed for new items.
interval: 10,
// Some feeds contain a `ttl` tag that specify the
// number of minutes to cache the feed.
// Setting this to true will ignore that.
forceInterval: false,
// If true, calls `reader.start()` when initialized.
autoStart: false,
// Emits items on the very first request.
// After which, it should consider those items read.
emitOnStart: false,
// Keeps track of last date of the feed.
lastDate: null,
// Maximum size of `history` array.
maxHistory: 10,
// Some feeds have a `skipHours` tag with a list of
// hours in which the feed should not be read.
// if this is set to true and the feed has that tag, it obeys that rule
skipHours: false,
// If you'd like to specify exactly what hours to skip.
hoursToSkip: [],
// Same as `skipHours`, but with days.
skipDays: false,
// Specify exactly what days to skip, ex: ['Saturday', 'Sunday'].
daysToSkip: [],
// Options object passed to [miniget](https://github.com/fent/node-miniget).
requestOpts: {}
}
Reads the feed. Calls callback
with possible error or new items discovered if provided. Causes reader
to emit new item events.
Starts checking the feed for any new items every options.interval
minutes. If readOnStart
is true, it checks right away.
Options that were passed to the constructor along with any defaults are kept here.
Stops the reader from automatically reading the feed.
Object
- Item.Emitted whenever there is a new item.
Array.<Object>
- List of items.Emits all new items from one request in one array.
Error
Emitted when there is an error downloading or parsing the feed. Not emitted if callback
is given for read
or readInterval
.
npm install feedsub
Tests are written with mocha
npm test
FAQs
Reads online RSS/Atom/JSON feeds notifying on new items.
We found that feedsub demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Socket’s new Tier 1 Reachability filters out up to 80% of irrelevant CVEs, so security teams can focus on the vulnerabilities that matter.
Research
/Security News
Ongoing npm supply chain attack spreads to DuckDB: multiple packages compromised with the same wallet-drainer malware.
Security News
The MCP Steering Committee has launched the official MCP Registry in preview, a central hub for discovering and publishing MCP servers.