Security News
PyPI Introduces Digital Attestations to Strengthen Python Package Security
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Feed is the simplest content syndication wrapper, letting you generate Atom 1.0 and RSS 2.0 feeds in no time!
The 'feed' npm package is a versatile tool for creating RSS, Atom, and JSON feeds. It provides a simple API to generate feeds in various formats, making it easy to syndicate content for blogs, podcasts, and other web applications.
Create an RSS Feed
This code sample demonstrates how to create an RSS feed using the 'feed' package. It initializes a new feed with metadata and adds an item to the feed. Finally, it outputs the RSS XML.
const { Feed } = require('feed');
const feed = new Feed({
title: 'Feed Title',
description: 'Feed Description',
id: 'http://example.com/',
link: 'http://example.com/',
language: 'en',
image: 'http://example.com/image.png',
favicon: 'http://example.com/favicon.ico',
updated: new Date(),
generator: 'Feed Generator',
feedLinks: {
rss: 'http://example.com/rss',
atom: 'http://example.com/atom',
json: 'http://example.com/json'
},
author: {
name: 'Author Name',
email: 'author@example.com',
link: 'http://example.com/author'
}
});
feed.addItem({
title: 'Post Title',
id: 'http://example.com/post',
link: 'http://example.com/post',
description: 'Post Description',
content: 'Post Content',
author: [
{
name: 'Author Name',
email: 'author@example.com',
link: 'http://example.com/author'
}
],
date: new Date()
});
console.log(feed.rss2());
Create an Atom Feed
This code sample demonstrates how to create an Atom feed using the 'feed' package. It initializes a new feed with metadata and adds an item to the feed. Finally, it outputs the Atom XML.
const { Feed } = require('feed');
const feed = new Feed({
title: 'Feed Title',
description: 'Feed Description',
id: 'http://example.com/',
link: 'http://example.com/',
language: 'en',
image: 'http://example.com/image.png',
favicon: 'http://example.com/favicon.ico',
updated: new Date(),
generator: 'Feed Generator',
feedLinks: {
rss: 'http://example.com/rss',
atom: 'http://example.com/atom',
json: 'http://example.com/json'
},
author: {
name: 'Author Name',
email: 'author@example.com',
link: 'http://example.com/author'
}
});
feed.addItem({
title: 'Post Title',
id: 'http://example.com/post',
link: 'http://example.com/post',
description: 'Post Description',
content: 'Post Content',
author: [
{
name: 'Author Name',
email: 'author@example.com',
link: 'http://example.com/author'
}
],
date: new Date()
});
console.log(feed.atom1());
Create a JSON Feed
This code sample demonstrates how to create a JSON feed using the 'feed' package. It initializes a new feed with metadata and adds an item to the feed. Finally, it outputs the JSON feed.
const { Feed } = require('feed');
const feed = new Feed({
title: 'Feed Title',
description: 'Feed Description',
id: 'http://example.com/',
link: 'http://example.com/',
language: 'en',
image: 'http://example.com/image.png',
favicon: 'http://example.com/favicon.ico',
updated: new Date(),
generator: 'Feed Generator',
feedLinks: {
rss: 'http://example.com/rss',
atom: 'http://example.com/atom',
json: 'http://example.com/json'
},
author: {
name: 'Author Name',
email: 'author@example.com',
link: 'http://example.com/author'
}
});
feed.addItem({
title: 'Post Title',
id: 'http://example.com/post',
link: 'http://example.com/post',
description: 'Post Description',
content: 'Post Content',
author: [
{
name: 'Author Name',
email: 'author@example.com',
link: 'http://example.com/author'
}
],
date: new Date()
});
console.log(feed.json1());
The 'rss' package is a simple RSS feed generator for Node.js. It provides a straightforward API to create RSS feeds but lacks support for Atom and JSON feeds, making it less versatile compared to 'feed'.
The 'rss-parser' package is primarily used for parsing RSS and Atom feeds rather than generating them. It is useful for consuming and processing feeds, whereas 'feed' is focused on feed creation.
The 'feedme' package is a robust feed parser that supports RSS, Atom, and JSON feeds. Similar to 'rss-parser', it is designed for parsing feeds rather than generating them, making it complementary to 'feed'.
Feed for Node.js is the simplest content syndication wrapper, letting you generate Atom 1.0 and RSS 2.0 feeds in no time!
$ npm install feed
First, add the module:
var Feed = require('feed');
Insert feed-specific information:
var feed = new Feed({
title: 'Feed Title',
description: 'This is my personnal feed!',
link: 'http://example.com/',
image: 'http://example.com/image.png',
copyright: 'All rights reserved 2013, John Doe',
author: {
name: 'John Doe',
email: 'johndoe@example.com',
link: 'https://example.com/johndoe'
}
});
Insert items using the item function:
for(var key in posts) {
feed.item({
title: posts[key].title,
link: posts[key].url,
description: posts[key].description,
date: posts[key].date
});
}
Output a RSS 2.0 feed:
feed.render('rss-2.0');
Output an Atom 1.0 feed:
feed.render('atom-1.0');
Yes, it's that simple :)!
This module is still a work in progress. If you have any suggestion, feel free to send me a message or a pull request :)!
FAQs
Feed is a RSS, Atom and JSON feed generator for Node.js, making content syndication simple and intuitive!
The npm package feed receives a total of 293,541 weekly downloads. As such, feed popularity was classified as popular.
We found that feed 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.
Security News
PyPI now supports digital attestations, enhancing security and trust by allowing package maintainers to verify the authenticity of Python packages.
Security News
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Security News
RubyGems.org has added a new "maintainer" role that allows for publishing new versions of gems. This new permission type is aimed at improving security for gem owners and the service overall.