Security News
GitHub Removes Malicious Pull Requests Targeting Open Source Repositories
GitHub removed 27 malicious pull requests attempting to inject harmful code across multiple open source repositories, in another round of low-effort attacks.
Feed is a RSS, Atom and JSON feed generator for Node.js, making content syndication simple and intuitive!
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'.
jpmonette/feed
- RSS 2.0, JSON Feed 1.0, and Atom 1.0 generator for Node.js
Making content syndication simple and intuitive!
👩🏻💻 Developer Ready: Quickly generate syndication feeds for your Website.
💪🏼 Strongly Typed: Developed using TypeScript / type-safe.
🔒 Tested: Tests & snapshot for each syndication format to avoid regressions.
$ yarn add feed
import { Feed } from "feed";
const feed = new Feed({
title: "Feed Title",
description: "This is my personal feed!",
id: "http://example.com/",
link: "http://example.com/",
language: "en", // optional, used only in RSS 2.0, possible values: http://www.w3.org/TR/REC-html40/struct/dirlang.html#langcodes
image: "http://example.com/image.png",
favicon: "http://example.com/favicon.ico",
copyright: "All rights reserved 2013, John Doe",
updated: new Date(2013, 6, 14), // optional, default = today
generator: "awesome", // optional, default = 'Feed for Node.js'
feedLinks: {
json: "https://example.com/json",
atom: "https://example.com/atom"
},
author: {
name: "John Doe",
email: "johndoe@example.com",
link: "https://example.com/johndoe"
}
});
posts.forEach(post => {
feed.addItem({
title: post.title,
id: post.url,
link: post.url,
description: post.description,
content: post.content,
author: [
{
name: "Jane Doe",
email: "janedoe@example.com",
link: "https://example.com/janedoe"
},
{
name: "Joe Smith",
email: "joesmith@example.com",
link: "https://example.com/joesmith"
}
],
contributor: [
{
name: "Shawn Kemp",
email: "shawnkemp@example.com",
link: "https://example.com/shawnkemp"
},
{
name: "Reggie Miller",
email: "reggiemiller@example.com",
link: "https://example.com/reggiemiller"
}
],
date: post.date,
image: post.image
});
});
feed.addCategory("Technologie");
feed.addContributor({
name: "Johan Cruyff",
email: "johancruyff@example.com",
link: "https://example.com/johancruyff"
});
console.log(feed.rss2());
// Output: RSS 2.0
console.log(feed.atom1());
// Output: Atom 1.0
console.log(feed.json1());
// Output: JSON Feed 1.0
< 3.0.0
If you are migrating from a version older than 3.0.0
, be sure to update your import as we migrated to ES6 named imports.
If your environment supports the ES6 module syntax, you can import
as described above:
import { Feed } from "feed";
Otherwise, you can stick with require()
:
- const Feed = require('feed');
+ const Feed = require('feed').Feed;
Copyright (C) 2013, Jean-Philippe Monette contact@jpmonette.net
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4.0.0 (2019-07-06)
Merged pull requests:
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
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.
Security News
Node.js will be enforcing stricter semver-major PR policies a month before major releases to enhance stability and ensure reliable release candidates.