npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

atomfeed

v1.1.0

Published

Atom 1.0 feed generator.

Readme

AtomFeed

A TypeScript library for generating Atom feeds, supporting pagination and XML stylesheets.

Features

  • Implements core Atom feed features
  • Type-safe API with comprehensive TypeScript definitions
  • High-level BlogFeed interface for common blogging use cases
  • Low-level RawAtomFeed interface for complete control
  • Built-in validation for dates, language tags, and required fields
  • Support for XML stylesheets
  • Pagination helpers
  • Entry sorting options
  • Flexible author/contributor management
  • Support for both text and HTML content

Installation

npm install atomfeed
# or
yarn add atomfeed

Quick Start

import { BlogFeed } from "atomfeed";

// Create a new feed
const feed = new BlogFeed({
  id: "https://example.com/blog",
  title: "My Blog",
  subtitle: "Thoughts and musings",
  author: {
    name: "John Doe",
    email: "[email protected]",
    website: "https://example.com",
  },
});

// Add a post
feed.addPost({
  id: "https://example.com/blog/first-post",
  title: "My First Post",
  content: "<p>Hello, world!</p>",
  contentType: "html",
  published: new Date(),
  categories: ["introduction", "first-post"],
});

// Generate the feed XML
const xml = feed.generate();

BlogFeed API

Constructor Options

interface BlogFeedOptions {
  id: string;
  title: string;
  subtitle?: string;
  description?: string;
  author?: Author;
  authors?: Author | Author[];
  contributors?: Author | Author[];
  links?: string | string[];
  pagination?: PaginationLinks;
  language?: string;
  updated?: Date;
  icon?: string;
  logo?: string;
  rights?: string;
  stylesheet?: string;
}

interface Author {
  name: string;
  email?: string;
  website?: string;
}

Methods

  • addPost(post: BlogPost): Add a new post to the feed
  • removePost(postId: string): Remove a post by ID
  • getPosts(): Get all posts in the feed
  • clear(): Remove all posts
  • generate(): Generate the feed XML
  • setPagination(pagination: PaginationLinks): Update pagination links
  • getPagination(): Get current pagination links

BlogPost Interface

interface BlogPost {
  id: string;
  title: string;
  content: string;
  contentType?: "text" | "html" | "xhtml";
  summary?: string;
  author?: Author;
  authors?: Author | Author[];
  contributors?: Author | Author[];
  published?: Date;
  updated?: Date;
  links?: string | string[];
  categories?: string | string[];
  rights?: string;
}

RawAtomFeed API

For cases requiring more control, the RawAtomFeed class provides direct access to building the Atom structures.

import { RawAtomFeed } from "atom-feed";

const feed = new RawAtomFeed(
  {
    id: "https://example.com/feed",
    title: {
      content: "My Feed",
      type: "text",
    },
    updated: new Date(),
  },
  false,
  true
);

feed.addEntry({
  id: "https://example.com/entry1",
  title: {
    content: "Entry Title",
    type: "text",
  },
  updated: new Date(),
  content: {
    content: "<p>Entry content</p>",
    type: "html",
  },
});

const xml = feed.toXml();

See the type definitions for complete FeedOptions and Entry interfaces.

Validation

The library performs validation for:

  • RFC 3339 dates
  • Language tags (RFC 5646)
  • Required fields according to the Atom specification
  • Link relations and attributes
  • XML content types

Examples

Feed with Pagination

const feed = new BlogFeed({
  id: "https://example.com/blog",
  title: "My Blog",
  pagination: {
    first: "https://example.com/blog/page/1",
    last: "https://example.com/blog/page/5",
    next: "https://example.com/blog/page/2",
    current: "https://example.com/blog/page/1",
  },
});

Multiple Authors

const feed = new BlogFeed({
  id: "https://example.com/blog",
  title: "Team Blog",
  authors: [
    {
      name: "Alice Smith",
      email: "[email protected]",
    },
    {
      name: "Bob Jones",
      email: "[email protected]",
    },
  ],
});

Custom Stylesheet

const feed = new BlogFeed({
  id: "https://example.com/blog",
  title: "My Blog",
  stylesheet: "https://example.com/feed.xsl",
});

License

MIT