UNPKG

@bliztek/feed-generator

Version:

A simple and lightweight Node.js library for generating RSS 2.0, Atom, and JSON Feed formats.

25 lines (24 loc) 1.31 kB
import { Feed, FeedFormat, FeedOptions, FeedOutput } from "./types.js"; /** * Generate a feed in a single format. * * @param feed - Feed data. Must include `title`, `link`, and `items`. RSS also requires `description`. * @param format - Output format: `"rss"`, `"atom"`, or `"json"`. * @param options - Optional settings: `sanitize` strips dangerous HTML; `pretty` (default `true`) toggles indentation. * @returns XML string (RSS/Atom) or JSON string. * @throws {FeedValidationError} If the feed data is invalid for the given format. */ export declare const generateFeed: (feed: Feed, format: FeedFormat, options?: FeedOptions) => string; /** * Generate RSS, Atom, and JSON Feed output in a single call. * * @param feed - Feed data. Must include `title`, `link`, `description`, and `items`. * @param options - Optional settings: `sanitize` strips dangerous HTML; `pretty` (default `true`) toggles indentation. * @returns An object with `rss`, `atom`, and `json` string properties. * @throws {FeedValidationError} If the feed data is invalid. */ export declare const generateFeeds: (feed: Feed, options?: FeedOptions) => FeedOutput; export { FeedValidationError } from "./validate.js"; export { FeedBuilder } from "./builder.js"; export type { XmlNode } from "./xml.js"; export * from "./types.js";