Skip to content
/ feed Public

A modern, fast, and easy-to-use RSS, JSON and Atom feed generator for Deno and the web.

License

Notifications You must be signed in to change notification settings

GabsEdits/feed

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

53 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Feed logo

A modern, fast, and easy-to-use RSS, JSON and Atom feed generator for Deno and the web.
Replacement for feed package.

JSR JSR Score GitHub Actions Workflow Status

  • Build with modern technologies, and the latest standards, using TypeScript and Deno.
  • Using JSR, insuring the best performance, and the best compatibility.
  • Supported feed formats: RSS 2.0, Atom 1.0 and JSON Feed 1.1.
  • Build for Deno, and supports Node.js, and more.
  • Easy to use, and easy to customize.
  • Typed, and fully documented.
  • No dependencies.
  • Fully tested.

Getting Started

Installation

Installation can be simply done by importing the generator you want to use, like so:

import { Atom } from "jsr:@feed/feed";

But, you can also just download the package, simply by running:

deno install jsr:@feed/feed

or

npx jsr add @feed/feed

Examples

Atom Feed

import { Atom } from "jsr:@feed/feed";

const atomFeed = new Atom({
  title: "Atom Feed Example",
  description: "A simple Atom feed example",
  link: "http://example.com/atom-feed",
  authors: [
    {
      name: "John Doe",
    },
  ],
  id: "https://example.com/atom-feed",
});

atomFeed.addItem({
  title: "First Atom Item",
  link: "http://example.com/atom1",
  id: "1",
  updated: new Date(),
  summary: "Summary for Atom item 1",
  content: {
    body: "Content for Atom item 1",
    type: "html",
  },
});

Deno.writeTextFileSync("example.xml", atomFeed.build());

RSS Feed

import { Rss } from "jsr:@feed/feed";

const rssFeed = new Rss({
  title: "RSS Feed Example",
  description: "A simple RSS feed example",
  link: "http://example.com/rss-feed",
  id: "http://example.com/rss-feed",
  authors: [
    {
      name: "John Doe",
      email: "test@example.org",
    },
  ],
});

rssFeed.addItem({
  title: "First RSS Item",
  link: "http://example.com/rss1",
  id: "http://example.com/rss1",
  updated: new Date("2024-10-19T15:12:56Z"),
  description: "Description for RSS item 1",
  content: {
    body: "Content for RSS item 1",
    type: "html",
  },
});

Deno.writeTextFileSync("example.rss", rssFeed.build());

JSON Feed

import { Json } from "jsr:@feed/feed";

const jsonFeed = new Json({
  title: "JSON Feed Example",
  description: "A simple JSON feed example",
  link: "http://example.com/json-feed",
  feed: "http://example.com/json-feed/feed.json",
  authors: [
    {
      name: "John Doe",
      email: "test@example.org",
    },
  ],
});

jsonFeed.addItem({
  id: "1",
  title: "First JSON Item",
  url: "http://example.com/json1",
  date_published: new Date("2024-10-19T15:12:56Z"),
  content_html: "Content for JSON item 1",
});

Deno.writeTextFileSync("example.json", jsonFeed.build());

Documentation

You can find the full documentation here.

Know your rights

This project is under the GPL-3.0 License:

  • Permissions: Commercial use, Modification, Distribution, Private use.
  • Limitations: Liability, Warranty.
  • Conditions: License and copyright notice. State changes, and Disclose source.

Read the full license here.

Contributing

Please read the CONTRIBUTING.md file for more information.