Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

feed

Package Overview
Dependencies
Maintainers
1
Versions
30
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

feed

Feed is a RSS, Atom and JSON feed generator for Node.js, making content syndication simple and intuitive!

  • 4.2.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created

What is feed?

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.

What are feed's main functionalities?

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());

Other packages similar to feed

Keywords

FAQs

Package last updated on 22 Jan 2021

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc