
Company News
/Security News
Socket Selected for OpenAI's Cybersecurity Grant Program
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.
feed-generator
Advanced tools
Easy RSS feed generation in Node.js, supports most used RSS extensions like itunes for podcast generation.
Install from npm:
npm install feed-generator --save
Example script for generating a minimal RSS feed:
var feedster = require('feed-generator');
// create feed with required elements
var feed = feedster.createFeed({
title: 'My Awesome Blog'
description: 'The best blog you have ever seen'
link: 'http://path/to/blog'
});
// add new item to the feed
feed.addItem({
// an item needs to contain either title or description, all other fields are optional
title: 'My first blog post',
// pubDate is not required but really useful
pubDate: '2011-01-01 11:12:34 +0000'
});
// generate a RSS string and print to console
var rss = feed.render();
console.log(rss);
Require feedster module
var feedster = require('feed-generator');
var feed = feedster.createFeed(headers)
Where
Example
var feedster = require('feed-generator');
var feed = feedster.createFeed({
title: 'My Awesome Blog'
});
Add additional item to the feed with
feed.addItem(item)
Where
Example
var feedster = require('feed-generator');
var feed = feedster.createFeed();
feed.addItem({
title: 'My first blog post',
pubDate: '2011-01-01 14:34:00'
})
Generate feed object into a rss feed string with
var rss = feed.render([options])
Where
" " for 2-spaces indentation etc.Example
var feedster = require('feed-generator');
var feed = feedster.createFeed({
title: 'My Awesome Blog'
});
feed.addItem({
title: 'My first blog post',
// thats badly formatted date (no timezone etc.) but it works
pubDate: '2011-01-01 14:34:00'
})
var rss = feed.render({indent: ' '});
console.log(rss);
Output:
<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0">
<channel>
<title>My Awesome Blog</title>
<lastBuildDate>Sat, 1 Jan 2011 14:34:00 +0200</lastBuildDate>
<item>
<title>My first blog post</title>
<pubDate>Sat, 1 Jan 2011 14:34:00 +0200</pubDate>
</item>
</channel>
</rss>
Defines a category or a tag to which the feed belongs. The value is either a string, or an object or an array of mixed strings and objects for multiple categories. Category object has two properties:
Domain is rarely used, so just using strings with category names is sufficient for most cases
var headers = {
category: [
// first category as a plain string
'Category1',
// second category as an object
{
value: 'Category2/Subcategory/SubSub',
domain: 'dmoz'
}
]
};
Indicates that updates to the feed can be monitored using a web service. Defined by an object with the following properties:
var headers = {
cloud: {
domain: "server.example.com",
path: "/rpc",
port: "80",
protocol: "xml-rpc",
registerProcedure: "cloud.notify"
}
};
A string about the copyright holder.
var headers = {
copyright: '© 2015 My Name'
};
Required value
Summary of the feed.
var headers = {
description: 'Latest posts from my awesome blog'
};
URL to RSS format specification.
var headers = {
docs: 'http://www.rssboard.org/rss-specification'
};
Software that created the feed.
var headers = {
generator: 'My Awesome Feed Generator v1.0'
};
Graphical logo for the feed. Either an url to the image or an object with the following properties:
headers.link is usedheaders.title is usedvar headers = {
image: 'http://image/location'
};
var headers = {
image: {
url: 'http://image/location',
link: 'http://link/to/blog',
title: 'My Blog Logo'
}
};
Language code.
var headers = {
language: 'en-us'
};
Last modification date. If not set defaults to the time of the newest post in the feed. Recommended option is to not set it manually.
var headers = {
lastBuildDate: '2011-01-01 13:34:11'
};
Required value
URL of the website.
var headers = {
link: 'http://path/to/my/blog'
};
E-mail address and name of the person to contact regarding the editorial content of the feed. Has the following properties:
var headers = {
managingEditor: {
name: 'Editor Name',
email: 'editor@example.com'
}
};
Publication date and time of the feed's content. Recommended option is to skip it and rely only on auto-generated lastBuildDate.
The value can either be a Date object or a datetime string (any valid format is ok, the value is converted to RSS date format automatically).
var headers = {
pubDate: new Date()
};
Advisory label for the content in a feed.
var headers = {
rating: '(PICS-1.1 "http://www.rsac.org/ratingsv01.html" l by "webmaster@example.com" on "2007.01.29T10:09-0800" r (n 0 s 0 v 0 l 0))'
};
Defines a form to submit a text query to the feed's publisher. Nobody uses it, seems pretty strange but it is supported by feedster nevertheless. An object with the following properties:
var headers = {
textInput: {
description: 'Your aggregator supports the textInput element. What software are you using?',
link: 'http://www.cadenhead.org/textinput.php',
name: 'query',
title: 'TextInput Inquiry'
}
};
Required value
The name of the feed.
var headers = {
title: 'My Awesome Blog'
};
E-mail address and name of the person to contact regarding technical issues about the feed. Has the following properties:
var headers = {
webMaster: {
name: 'Webmaster Name',
email: 'webmaster@example.com'
}
};
atomLink maps to atom:link from the Atom specification that defines a relationship between a web resource (such as a page) and an RSS channel. For multiple link elements, use an array for the values.
An object with the following properties:
var headers = {
atomLink: {
href: 'http://path/to/feed',
rel: 'self' // type is automatically for "self"
}
};
hub maps to atom:link with rel="hub". Takes a string value which is an URL pointing to the PubSubHubbub hub.
var headers = {
hub: 'http://path/to/hub'
};
itunes is an object that maps to the itunes specification and is used for podcasting. Channel level itunes element supports the following properties:
name and emailCategory format
"Business"["Business", "Technology"]{name: "Business", sub: ["Careers"]}You can't use random values as categories, see available categories from the iTunes Categories for Podcasting section in itunes module documentation.
var headers = {
itunes: {
author: 'Your\'s truly',
block: true, // hide this podcast from the directory
explicit: true, // show parental advisory graphic
owner: {
name: 'My Name',
email: 'my@example.com'
},
category: {
value: 'Business', // main category
sub: ['Careers', 'Football'] // sub categories
}
}
};
updatePeriod maps to sy:updatePeriod from the Syndication module. Describes a period over which the channel format is updated. Acceptable values are: hourly, daily, weekly, monthly, yearly. Defaults to daily.
var headers = {
updatePeriod: 'hourly'
};
updateFrequency maps to sy:updateFrequency from the Syndication module. A positive integer that describes how many times the channel is updated in selected update period.
var headers = {
// updated once in a hour
updatePeriod: 'hourly',
updateFrequency: 1
};
The person who wrote the item. Has the following properties:
feed.additem({
author: {
name: 'Author Name',
email: 'author@example.com'
}
});
Recommended action is to use
creatorinstead ofauthorascreatordoes not require an e-mail address value
Defines a category or tag for the item. A string or an object. For multiple categories, use an array for the values. Category object has the following properties:
Domain is rarely used, so just using strings with category names is sufficient for most cases
feed.additem({
category: [
// first category as a plain string
'Category1',
// second category as an object
{
value: 'Category2/Subcategory/SubSub',
domain: 'dmoz'
}
]
});
Points to an URL where comments for the item can be found.
feed.additem({
comments: 'http://path/to/comments'
});
Item's full content or a summary of its contents. Either title or description has to be set for the item, using both is optional. Usually description is used for a summary and the content extension element (see below) is used for the full contents.
feed.additem({
description: 'Just another rant about my awesomness'
});
Associates a media object, usually an audio or video file. The value can be an URL pointing to the media object or an object value with the following properties:
If length is not defined, a default value of "0" is used. If type is missing, it is detected from the file extension of the url.
feed.additem({
enclosure: 'http://path/to/assets/podcast.mp3'
});
feed.additem({
enclosure: {
url: 'http://path/to/assets/podcast.mp3',
type: 'audio/mpeg',
length: 12345
}
});
A string value that uniquely identifies the item. Recommended action would be to use the permalink to the item as guid, this is also the default if isPermaLink option is not used.
If the value is permalink, then you can use the URL as the value, otherwise use an object with the following properties:
feed.additem({
guid: 'http://path/to/posts/1'
});
feed.additem({
guid: {
value: 'some-unique-identifier',
isPermaLink: false
}
});
The URL pointing to a web page associated with the item.
feed.additem({
link: 'http://path/to/posts/1'
});
Publication date and time of the item. The value can either be a Date object or a datetime string (any valid format is ok, the value is converted to RSS date format automatically).
feed.additem({
pubDate: new Date()
});
Indicates the original source RSS of the entry. An object with the following properties:
feed.additem({
source: {
title: 'Some Other Publication',
url: 'http://path/to/publication.rss'
}
});
Item's headline. Either title or description has to be set for the item, using both is optional.
feed.additem({
title:
});
commentCount maps to slash:comments from the Slashdot module and contains a positive integer as the count of comments for the item.
feed.additem({
commentCount: 123
});
commentRss maps to wfw:commentRss from the Well Formed Web Comments module and includes an URL to the comments RSS feed for the item.
feed.additem({
commentRss: 'http://path/to/post/1/comments/feed'
});
content maps to content:encoded from the content module and contains the full contents for the item. Mostly used together with the description element where description holds the summary.
feed.additem({
content: '<p>Full text contents</p>',
description: 'Summary of the post'
});
creator maps to dc:creator from Dublin Core and is a string with the name of the person who created the item.
feed.additem({
creator: 'My name'
});
itunes is an object that maps to the itunes specification and is used for podcasting. Item level itunes element goes together with enclosure element that defines the actual podcast show, itunes only adds metadata to it. The object supports the following properties:
var headers = {
enclosure: 'http://path/to/assets/podcast.mp3',
itunes: {
author: 'Your\'s truly',
duration: '13:34'
}
};
lat and long map to geo:lat and geo:long from the Basic Geo module. The values indicate a geographical point related to the item.
feed.additem({
lat: 55.701,
long: 12.552
});
media is an object that maps to media:content of the Media RSS module. For multiple media elements, use an array for the values.
Media object supports the following properties:
feed.additem({
media: {
url: 'http://path/to/assets/1.jpg',
medium: 'image',
title: 'Attached image',
restriction: {
type: 'sharing',
relationship: 'deny'
}
}
});
MIT
FAQs
Generate RSS feeds with support for a variety of extensions
We found that feed-generator 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.

Company News
/Security News
Socket is an initial recipient of OpenAI's Cybersecurity Grant Program, which commits $10M in API credits to defenders securing open source software.

Security News
Socket CEO Feross Aboukhadijeh joins 10 Minutes or Less, a podcast by Ali Rohde, to discuss the recent surge in open source supply chain attacks.

Research
/Security News
Campaign of 108 extensions harvests identities, steals sessions, and adds backdoors to browsers, all tied to the same C2 infrastructure.