sitemap

  • Version 10.0.0
  • Published
  • 238 kB
  • 3 dependencies
  • MIT license

Install

npm i sitemap
yarn add sitemap
pnpm add sitemap

Overview

Sitemap-generating lib/cli

Index

Variables

Functions

Classes

Interfaces

Enums

Type Aliases

Variables

variable DEFAULT_SITEMAP_ITEM_LIMIT

const DEFAULT_SITEMAP_ITEM_LIMIT: number;
  • Default maximum number of items in each sitemap XML file, shared by SitemapAndIndexStream, simpleSitemapAndIndex and the CLI. Set below the 50,000 max to leave headroom under the 50MB uncompressed file-size limit, which entries with images, video or news can approach.

    See Also

    • https://www.sitemaps.org/protocol.html#index

variable LIMITS

const LIMITS: {
readonly MAX_URL_LENGTH: 2048;
readonly URL_PROTOCOL_REGEX: RegExp;
readonly MIN_SITEMAP_ITEM_LIMIT: 1;
readonly MAX_SITEMAP_ITEM_LIMIT: 50000;
readonly MIN_PRIORITY: 0;
readonly MAX_PRIORITY: 1;
readonly PRIORITY_STRING_REGEX: RegExp;
readonly MIN_VIDEO_DURATION: 0;
readonly MAX_VIDEO_DURATION: 28800;
readonly MIN_VIDEO_RATING: 0;
readonly MAX_VIDEO_RATING: 5;
readonly MIN_VIDEO_VIEW_COUNT: 0;
readonly MAX_VIDEO_TITLE_LENGTH: 100;
readonly MAX_VIDEO_DESCRIPTION_LENGTH: 2048;
readonly MAX_VIDEO_CATEGORY_LENGTH: 256;
readonly MAX_TAGS_PER_VIDEO: 32;
readonly MAX_NEWS_TITLE_LENGTH: 200;
readonly MAX_NEWS_NAME_LENGTH: 256;
readonly MAX_IMAGE_CAPTION_LENGTH: 512;
readonly MAX_IMAGE_TITLE_LENGTH: 512;
readonly MAX_IMAGES_PER_URL: 1000;
readonly MAX_VIDEOS_PER_URL: 100;
readonly MAX_LINKS_PER_URL: 100;
readonly MAX_URL_ENTRIES: 50000;
readonly ISO_DATE_REGEX: RegExp;
readonly MAX_CUSTOM_NAMESPACES: 20;
readonly MAX_NAMESPACE_LENGTH: 512;
readonly MAX_PARSER_CHAR_DATA_LENGTH: 65536;
readonly MAX_PARSER_ERRORS: 100;
};
  • Security limits for sitemap generation and parsing

    These limits are based on: - sitemaps.org protocol specification - Security best practices to prevent DoS and injection attacks - Google's sitemap extension specifications

    See Also

    • https://www.sitemaps.org/protocol.html

    • https://developers.google.com/search/docs/advanced/sitemaps/build-sitemap

variable validators

const validators: { [index: string]: RegExp };

    Functions

    function isAllowDeny

    isAllowDeny: (ad: string) => ad is EnumAllowDeny;
    • Type guard to check if a string is a valid allow/deny value

    function isPriceType

    isPriceType: (pt: string | PriceType) => pt is PriceType;
    • Type guard to check if a string is a valid price type

    function isResolution

    isResolution: (res: string) => res is Resolution;
    • Type guard to check if a string is a valid resolution

    function isValidChangeFreq

    isValidChangeFreq: (freq: string) => freq is EnumChangefreq;

      function isValidYesNo

      isValidYesNo: (yn: string) => yn is EnumYesNo;
      • Type guard to check if a string is a valid yes/no value

      function lineSeparatedURLsToSitemapOptions

      lineSeparatedURLsToSitemapOptions: (
      stream: Readable,
      { isJSON }?: { isJSON?: boolean }
      ) => Readable;
      • Takes a stream likely from fs.createReadStream('./path') and returns a stream of sitemap items

        Parameter stream

        a stream of line separated urls.

        Parameter

        opts.isJSON is the stream line separated JSON. leave undefined to guess

      function mergeStreams

      mergeStreams: (streams: Readable[], options?: TransformOptions) => Readable;
      • Combines multiple streams into one

        Parameter streams

        the streams to combine

      function normalizeURL

      normalizeURL: (
      elem: string | SitemapItemLoose,
      hostname?: string,
      lastmodDateOnly?: boolean
      ) => SitemapItem;
      • Converts the passed in sitemap entry into one capable of being consumed by SitemapItem

        Parameter elem

        the string or object to be converted

        Parameter hostname

        Returns

        SitemapItemOptions a strict sitemap item option

      function parseSitemap

      parseSitemap: (xml: Readable) => Promise<SitemapItem[]>;
      • Read xml and resolve with the configuration that would produce it or reject with an error ``` import { createReadStream } from 'fs' import { Readable } from 'stream' import { parseSitemap, SitemapStream, streamToPromise } from 'sitemap' const items = await parseSitemap(createReadStream('./example.xml')) // produces the same xml // you can, of course, more practically modify it or store it const sms = new SitemapStream() Readable.from(items).pipe(sms) console.log((await streamToPromise(sms)).toString()) ``` Once the sitemap passes 50,000 <url> entries, parsing stops: xml is destroyed and the promise resolves with the first 50,000 items.

        Parameter xml

        what to parse {Promise<SitemapItem[]>} resolves with list of sitemap items that can be fed into a SitemapStream. Rejects with an Error object if xml or the parser fails, including on truncated XML.

      function parseSitemapIndex

      parseSitemapIndex: (xml: Readable, maxEntries?: number) => Promise<IndexItem[]>;
      • Read xml and resolve with the configuration that would produce it or reject with an error ``` import { createReadStream } from 'fs' import { Readable } from 'stream' import { parseSitemapIndex, SitemapIndexStream, streamToPromise } from 'sitemap' const items = await parseSitemapIndex(createReadStream('./example-index.xml')) // produces the same xml // you can, of course, more practically modify it or store it const smis = new SitemapIndexStream() Readable.from(items).pipe(smis) console.log((await streamToPromise(smis)).toString()) ```

        Parameter xml

        what to parse

        Parameter maxEntries

        Maximum number of sitemap entries to parse (default: 50,000 per sitemaps.org spec). Values above 50,000 have no effect: the spec caps a sitemap index at 50,000 entries, and larger sets must be split. 0 rejects on the first entry. Anything other than a non-negative integer or Infinity rejects immediately. {Promise<IndexItem[]>} resolves with list of index items that can be fed into a SitemapIndexStream. Rejects with an Error object.

      function simpleSitemapAndIndex

      simpleSitemapAndIndex: ({
      hostname,
      sitemapHostname,
      sourceData,
      destinationDir,
      limit,
      gzip,
      publicBasePath,
      xslUrl,
      logger,
      }: SimpleSitemapAndIndexOptions) => Promise<void>;
      • A simpler interface for creating sitemaps and indexes. Automatically handles splitting large datasets into multiple sitemap files.

        Parameter options

        Configuration options

        Returns

        A promise that resolves when all sitemaps and the index are written

        Throws

        {InvalidHostnameError} If hostname or sitemapHostname is invalid

        Throws

        {InvalidPathError} If destinationDir contains path traversal

        Throws

        {InvalidPublicBasePathError} If publicBasePath is invalid

        Throws

        {InvalidLimitError} If limit is out of range

        Throws

        {InvalidXSLUrlError} If xslUrl is invalid

        Throws

        {Error} If sourceData type is not supported

      function streamToPromise

      streamToPromise: (stream: Readable) => Promise<Buffer>;
      • Converts a readable stream into a promise that resolves with the concatenated data from the stream.

        The function listens for 'data' events from the stream, and when the stream ends, it resolves the promise with the concatenated data. If an error occurs while reading from the stream, the promise is rejected with the error.

        ⚠️ CAUTION: This function should not generally be used in production / when writing to files as it holds a copy of the entire file contents in memory until finished.

        Parameter stream

        The readable stream to convert to a promise.

        Returns

        {Promise} A promise that resolves with the concatenated data from the stream as a Buffer, or rejects with an error if one occurred while reading from the stream. If the stream is empty, the promise is rejected with an EmptyStream error.

        Throws

        {EmptyStream} If the stream is empty.

      function validateLimit

      validateLimit: (limit: number) => void;
      • Validates that a limit is within acceptable range per sitemaps.org spec

        Security: This function enforces sitemap size limits (1-50,000 URLs per sitemap) as specified by sitemaps.org. This prevents resource exhaustion attacks and ensures compliance with search engine requirements.

        Parameter limit

        The limit to validate

        Throws

        {InvalidLimitError} If the limit is out of range

      function validatePath

      validatePath: (path: string, paramName: string) => void;
      • Validates that a path doesn't contain path traversal sequences

        Security: This function prevents path traversal attacks by detecting any occurrence of '..' in the path, whether it appears as '../', '/..', or standalone. This prevents attackers from accessing files outside the intended directory structure.

        Parameter path

        The path to validate

        Parameter paramName

        The parameter name for error messages

        Throws

        {InvalidPathError} If the path contains traversal sequences

      function validatePublicBasePath

      validatePublicBasePath: (publicBasePath: string) => void;
      • Validates that a public base path is safe for URL construction

        Security: This function prevents path traversal attacks and validates that the path is safe for use in URL construction within sitemap indexes. It checks for '..' sequences, null bytes, and invalid whitespace that could be used to manipulate URL structure or inject malicious content.

        Parameter publicBasePath

        The public base path to validate

        Throws

        {InvalidPublicBasePathError} If the path is invalid

      function validateSMIOptions

      validateSMIOptions: (
      conf: SitemapItem,
      level?: ErrorLevel,
      errorHandler?: ErrorHandler
      ) => SitemapItem;
      • Verifies all data passed in will comply with sitemap spec.

        Parameter conf

        Options to validate

        Parameter level

        logging level

        Parameter errorHandler

        error handling func

      function validateURL

      validateURL: (url: string, paramName: string) => void;
      • Validates that a URL is well-formed and meets security requirements

        Security: This function enforces that URLs use safe protocols (http/https), are within reasonable length limits (2048 chars per sitemaps.org spec), and can be properly parsed. This prevents protocol injection attacks and ensures compliance with sitemap specifications.

        Parameter url

        The URL to validate

        Parameter paramName

        The parameter name for error messages

        Throws

        {InvalidURLError} If the URL is invalid (a subclass of InvalidHostnameError)

      function validateXSLUrl

      validateXSLUrl: (xslUrl: string) => void;
      • Validates that an XSL URL is safe and well-formed

        Security: This function validates XSL stylesheet URLs to prevent injection attacks. It blocks dangerous protocols and content patterns that could be used for XSS or other attacks. The validation uses case-insensitive matching to catch obfuscated attacks.

        Parameter xslUrl

        The XSL URL to validate

        Throws

        {InvalidXSLUrlError} If the URL is invalid

      function xmlLint

      xmlLint: (xml: string | Readable) => Promise<void>;
      • Verify the passed in xml is valid. Requires xmllib be installed

        Security: This function always pipes XML content via stdin to prevent command injection vulnerabilities. Never pass user-controlled strings as file path arguments to xmllint.

        Parameter xml

        what you want validated (string or Readable stream) {Promise} resolves on valid. Rejects with [error, stderr] when the xml is invalid, or with [error] alone when validation could not run (xmllint missing or not executable, or the schema not found).

      Classes

      class ChangeFreqInvalidError

      class ChangeFreqInvalidError extends Error {}
      • changefreq property in sitemap is invalid

      constructor

      constructor(url: string, changefreq: any);

        class EmptySitemap

        class EmptySitemap extends Error {}
        • Deprecated

          No longer thrown: since 10.0.0, SitemapStream emits an empty <urlset> when it ends without items. Kept so existing imports still resolve.

        constructor

        constructor();

          class EmptyStream

          class EmptyStream extends Error {}

            constructor

            constructor();

              class IndexObjectStreamToJSON

              class IndexObjectStreamToJSON extends Transform {}
              • A Transform that converts a stream of objects into a JSON Array or a line separated stringified JSON

                Parameter lineSeparated

                whether to separate entries by a new line or comma

              constructor

              constructor(opts?: IndexObjectStreamToJSONOptions);

                property firstWritten

                firstWritten: boolean;

                  property lineSeparated

                  lineSeparated: boolean;

                    class InvalidAttr

                    class InvalidAttr extends Error {}

                      constructor

                      constructor(key: string);

                        class InvalidAttrValue

                        class InvalidAttrValue extends Error {}

                          constructor

                          constructor(key: string, val: any, validator: RegExp, url?: string);

                            class InvalidHostnameError

                            class InvalidHostnameError extends Error {}

                              constructor

                              constructor(hostname: string, reason: string);

                                class InvalidLimitError

                                class InvalidLimitError extends Error {}

                                  constructor

                                  constructor(limit: any);

                                    class InvalidLinkHreflang

                                    class InvalidLinkHreflang extends Error {}
                                    • An alternate link has no lang or hreflang

                                    constructor

                                    constructor(url: string, href: string, value: {});

                                      class InvalidNewsAccessValue

                                      class InvalidNewsAccessValue extends Error {}

                                        constructor

                                        constructor(url: string, access: any);

                                          class InvalidNewsFormat

                                          class InvalidNewsFormat extends Error {}

                                            constructor

                                            constructor(url: string);

                                              class InvalidPathError

                                              class InvalidPathError extends Error {}

                                                constructor

                                                constructor(path: string, reason: string);

                                                  class InvalidPublicBasePathError

                                                  class InvalidPublicBasePathError extends Error {}

                                                    constructor

                                                    constructor(publicBasePath: string, reason: string);

                                                      class InvalidURLError

                                                      class InvalidURLError extends InvalidHostnameError {}
                                                      • A URL failed validateURL. Extends InvalidHostnameError so existing instanceof InvalidHostnameError checks keep working; the offending value is truncated so attacker-sized input is not copied into every message.

                                                      constructor

                                                      constructor(url: string, reason: string);

                                                        class InvalidVideoCategory

                                                        class InvalidVideoCategory extends Error {}

                                                          constructor

                                                          constructor(url: string, count: number);

                                                            class InvalidVideoDescription

                                                            class InvalidVideoDescription extends Error {}

                                                              constructor

                                                              constructor(url: string, length: number);

                                                                class InvalidVideoDuration

                                                                class InvalidVideoDuration extends Error {}

                                                                  constructor

                                                                  constructor(url: string, duration: any);

                                                                    class InvalidVideoFamilyFriendly

                                                                    class InvalidVideoFamilyFriendly extends Error {}

                                                                      constructor

                                                                      constructor(url: string, fam: string);

                                                                        class InvalidVideoFormat

                                                                        class InvalidVideoFormat extends Error {}

                                                                          constructor

                                                                          constructor(url: string);

                                                                            class InvalidVideoPriceCurrency

                                                                            class InvalidVideoPriceCurrency extends Error {}

                                                                              constructor

                                                                              constructor(url: string, currency: string);

                                                                                class InvalidVideoPriceType

                                                                                class InvalidVideoPriceType extends Error {}

                                                                                  constructor

                                                                                  constructor(url: string, priceType?: string, price?: string);

                                                                                    class InvalidVideoRating

                                                                                    class InvalidVideoRating extends Error {}

                                                                                      constructor

                                                                                      constructor(url: string, title: any, rating: any);

                                                                                        class InvalidVideoResolution

                                                                                        class InvalidVideoResolution extends Error {}

                                                                                          constructor

                                                                                          constructor(url: string, resolution: string);

                                                                                            class InvalidVideoRestriction

                                                                                            class InvalidVideoRestriction extends Error {}

                                                                                              constructor

                                                                                              constructor(url: string, code: string);

                                                                                                class InvalidVideoRestrictionRelationship

                                                                                                class InvalidVideoRestrictionRelationship extends Error {}

                                                                                                  constructor

                                                                                                  constructor(url: string, val?: string);

                                                                                                    class InvalidVideoTagCount

                                                                                                    class InvalidVideoTagCount extends Error {}

                                                                                                      constructor

                                                                                                      constructor(url: string, count: number);

                                                                                                        class InvalidVideoTitle

                                                                                                        class InvalidVideoTitle extends Error {}

                                                                                                          constructor

                                                                                                          constructor(url: string, length: number);

                                                                                                            class InvalidVideoViewCount

                                                                                                            class InvalidVideoViewCount extends Error {}

                                                                                                              constructor

                                                                                                              constructor(url: string, count: number);

                                                                                                                class InvalidVideoYesNo

                                                                                                                class InvalidVideoYesNo extends Error {}

                                                                                                                  constructor

                                                                                                                  constructor(url: string, field: string, value: string);

                                                                                                                    class InvalidXMLAttributeNameError

                                                                                                                    class InvalidXMLAttributeNameError extends Error {}

                                                                                                                      constructor

                                                                                                                      constructor(attributeName: string);

                                                                                                                        class InvalidXSLUrlError

                                                                                                                        class InvalidXSLUrlError extends Error {}

                                                                                                                          constructor

                                                                                                                          constructor(xslUrl: string, reason: string);

                                                                                                                            class NoConfigError

                                                                                                                            class NoConfigError extends Error {}
                                                                                                                            • Config was not passed to SitemapItem constructor

                                                                                                                            constructor

                                                                                                                            constructor(message?: string);

                                                                                                                              class NoURLError

                                                                                                                              class NoURLError extends Error {}
                                                                                                                              • URL in SitemapItem does not exist

                                                                                                                              constructor

                                                                                                                              constructor(message?: string);

                                                                                                                                class ObjectStreamToJSON

                                                                                                                                class ObjectStreamToJSON extends Transform {}
                                                                                                                                • A Transform that converts a stream of objects into a JSON Array or a line separated stringified JSON

                                                                                                                                  Parameter lineSeparated

                                                                                                                                  whether to separate entries by a new line or comma

                                                                                                                                constructor

                                                                                                                                constructor(opts?: ObjectStreamToJSONOptions);

                                                                                                                                  property firstWritten

                                                                                                                                  firstWritten: boolean;

                                                                                                                                    property lineSeparated

                                                                                                                                    lineSeparated: boolean;

                                                                                                                                      class PriorityInvalidError

                                                                                                                                      class PriorityInvalidError extends Error {}
                                                                                                                                      • priority property in sitemap is invalid

                                                                                                                                      constructor

                                                                                                                                      constructor(url: string, priority: any);

                                                                                                                                        class ReadlineStream

                                                                                                                                        class ReadlineStream extends Readable {}
                                                                                                                                        • Wraps node's ReadLine in a stream

                                                                                                                                        constructor

                                                                                                                                        constructor(options: ReadlineStreamOptions);

                                                                                                                                          class SitemapAndIndexStream

                                                                                                                                          class SitemapAndIndexStream extends SitemapIndexStream {}
                                                                                                                                          • SitemapAndIndexStream is a Transform stream that takes in sitemap items, writes them to sitemap files, adds the sitemap files to a sitemap index, and creates new sitemap files when the count limit is reached.

                                                                                                                                            It waits for the target stream of the current sitemap file to finish before moving on to the next if the target stream is returned by the getSitemapStream callback in the 3rd position of the tuple.

                                                                                                                                            ⚠️ CAUTION: This object is readable and must be read (e.g. piped to a file or to /dev/null) before finish will be emitted. Failure to read the stream will result in hangs.

                                                                                                                                            {SitemapIndexStream}

                                                                                                                                          constructor

                                                                                                                                          constructor(opts: SitemapAndIndexStreamOptions);
                                                                                                                                          • SitemapAndIndexStream is a Transform stream that takes in sitemap items, writes them to sitemap files, adds the sitemap files to a sitemap index, and creates new sitemap files when the count limit is reached.

                                                                                                                                            It waits for the target stream of the current sitemap file to finish before moving on to the next if the target stream is returned by the getSitemapStream callback in the 3rd position of the tuple.

                                                                                                                                            ⚠️ CAUTION: This object is readable and must be read (e.g. piped to a file or to /dev/null) before finish will be emitted. Failure to read the stream will result in hangs.

                                                                                                                                            Parameter opts

                                                                                                                                            Stream options.

                                                                                                                                          class SitemapIndexStream

                                                                                                                                          class SitemapIndexStream extends Transform {}
                                                                                                                                          • SitemapIndexStream is a Transform stream that takes IndexItems or sitemap URL strings and outputs a stream of sitemap index XML.

                                                                                                                                            It automatically handles the XML declaration and the opening and closing tags for the sitemap index.

                                                                                                                                            ⚠️ CAUTION: This object is readable and must be read (e.g. piped to a file or to /dev/null) before finish will be emitted. Failure to read the stream will result in hangs.

                                                                                                                                            {Transform}

                                                                                                                                          constructor

                                                                                                                                          constructor(opts?: SitemapIndexStreamOptions);
                                                                                                                                          • SitemapIndexStream is a Transform stream that takes IndexItems or sitemap URL strings and outputs a stream of sitemap index XML.

                                                                                                                                            It automatically handles the XML declaration and the opening and closing tags for the sitemap index.

                                                                                                                                            ⚠️ CAUTION: This object is readable and must be read (e.g. piped to a file or to /dev/null) before finish will be emitted. Failure to read the stream will result in hangs.

                                                                                                                                            Parameter opts

                                                                                                                                            Stream options.

                                                                                                                                          property lastmodDateOnly

                                                                                                                                          lastmodDateOnly: boolean;

                                                                                                                                            property level

                                                                                                                                            level: ErrorLevel;

                                                                                                                                              property logger

                                                                                                                                              logger: Logger;

                                                                                                                                                property xslUrl

                                                                                                                                                xslUrl?: string;

                                                                                                                                                  class SitemapItemStream

                                                                                                                                                  class SitemapItemStream extends Transform {}
                                                                                                                                                  • Takes a stream of SitemapItemOptions and spits out xml for each

                                                                                                                                                    Parameter level

                                                                                                                                                    Error level

                                                                                                                                                    Example 1

                                                                                                                                                    // writes https://example.comhttps://example.com/2 const smis = new SitemapItemStream({level: 'warn'}) smis.pipe(writestream) smis.write({url: 'https://example.com', img: [], video: [], links: []}) smis.write({url: 'https://example.com/2', img: [], video: [], links: []}) smis.end()

                                                                                                                                                  constructor

                                                                                                                                                  constructor(opts?: SitemapItemStreamOptions);

                                                                                                                                                    property level

                                                                                                                                                    level: ErrorLevel;

                                                                                                                                                      class SitemapStream

                                                                                                                                                      class SitemapStream extends Transform {}
                                                                                                                                                      • A [Transform](https://nodejs.org/api/stream.html#stream_implementing_a_transform_stream) for turning a [Readable stream](https://nodejs.org/api/stream.html#stream_readable_streams) of either [SitemapItemOptions](#sitemap-item-options) or url strings into a Sitemap. The readable stream it transforms **must** be in object mode.

                                                                                                                                                        Parameter opts

                                                                                                                                                        Configuration options

                                                                                                                                                        Parameter

                                                                                                                                                        {string} [opts.hostname] - Base URL for relative paths. Must use http:// or https:// protocol

                                                                                                                                                        Parameter

                                                                                                                                                        {ErrorLevel} [opts.level=ErrorLevel.WARN] - Error handling level (SILENT, WARN, or THROW)

                                                                                                                                                        Parameter

                                                                                                                                                        {boolean} [opts.lastmodDateOnly=false] - Format lastmod as date only (YYYY-MM-DD)

                                                                                                                                                        Parameter

                                                                                                                                                        {NSArgs} [opts.xmlns] - Control which XML namespaces to include in output

                                                                                                                                                        Parameter

                                                                                                                                                        {string} [opts.xslUrl] - URL to XSL stylesheet for sitemap display. Must use http:// or https://

                                                                                                                                                        Parameter

                                                                                                                                                        {ErrorHandler} [opts.errorHandler] - Custom error handler function

                                                                                                                                                        Throws

                                                                                                                                                        {InvalidHostnameError} If hostname is provided but invalid (non-http(s), malformed, or >2048 chars)

                                                                                                                                                        Throws

                                                                                                                                                        {InvalidXSLUrlError} If xslUrl is provided but invalid (non-http(s), malformed, >2048 chars, or contains malicious content)

                                                                                                                                                        Throws

                                                                                                                                                        {Error} If xmlns.custom contains invalid namespace declarations

                                                                                                                                                        Example 1

                                                                                                                                                        const stream = new SitemapStream({
                                                                                                                                                        hostname: 'https://example.com',
                                                                                                                                                        level: ErrorLevel.THROW
                                                                                                                                                        });
                                                                                                                                                        stream.write({ url: '/page', changefreq: 'daily' });
                                                                                                                                                        stream.end();

                                                                                                                                                        - Hostname and xslUrl are validated to prevent URL injection attacks - Custom namespaces are validated to prevent XML injection - All URLs are normalized and validated before output - XML content is properly escaped to prevent injection

                                                                                                                                                      constructor

                                                                                                                                                      constructor(opts?: SitemapStreamOptions);

                                                                                                                                                        property errorHandler

                                                                                                                                                        errorHandler: ErrorHandler;

                                                                                                                                                          property hasHeadOutput

                                                                                                                                                          hasHeadOutput: boolean;

                                                                                                                                                            property hostname

                                                                                                                                                            hostname?: string;

                                                                                                                                                              property lastmodDateOnly

                                                                                                                                                              lastmodDateOnly: boolean;

                                                                                                                                                                property level

                                                                                                                                                                level: ErrorLevel;

                                                                                                                                                                  property logger

                                                                                                                                                                  logger: Logger;

                                                                                                                                                                    property xmlns

                                                                                                                                                                    xmlns: NSArgs;

                                                                                                                                                                      property xmlNS

                                                                                                                                                                      xmlNS: NSArgs;
                                                                                                                                                                      • Deprecated

                                                                                                                                                                        Use xmlns

                                                                                                                                                                      property xslUrl

                                                                                                                                                                      xslUrl?: string;

                                                                                                                                                                        class XMLLintUnavailable

                                                                                                                                                                        class XMLLintUnavailable extends Error {}

                                                                                                                                                                          constructor

                                                                                                                                                                          constructor(message?: string);

                                                                                                                                                                            class XMLToSitemapIndexStream

                                                                                                                                                                            class XMLToSitemapIndexStream extends SaxParserStream<IndexItem> {}
                                                                                                                                                                            • Takes a stream of xml and transforms it into a stream of IndexItems Use this to parse existing sitemap indices into config options compatible with this library

                                                                                                                                                                              Emits 'maxEntriesExceeded' (with the cap) once, when the first entry past maxEntries is seen. If nothing listens for that event, the stream logs the overflow through its logger instead.

                                                                                                                                                                            constructor

                                                                                                                                                                            constructor(opts?: XMLToSitemapIndexItemStreamOptions);

                                                                                                                                                                              method onAttribute

                                                                                                                                                                              protected onAttribute: (currentTag: string, attr: QualifiedAttribute) => void;

                                                                                                                                                                                method onCharData

                                                                                                                                                                                protected onCharData: (tag: string, text: string) => void;

                                                                                                                                                                                  method onCloseTag

                                                                                                                                                                                  protected onCloseTag: (tag: string) => void;

                                                                                                                                                                                    class XMLToSitemapItemStream

                                                                                                                                                                                    class XMLToSitemapItemStream extends SaxParserStream<SitemapItem> {}
                                                                                                                                                                                    • Takes a stream of xml and transforms it into a stream of SitemapItems Use this to parse existing sitemaps into config options compatible with this library

                                                                                                                                                                                      Emits 'maxEntriesExceeded' (with the cap) once, when the first <url> past maxEntries is seen. If nothing listens for that event, the stream logs the overflow through its logger instead.

                                                                                                                                                                                    constructor

                                                                                                                                                                                    constructor(opts?: XMLToSitemapItemStreamOptions);

                                                                                                                                                                                      property urlCount

                                                                                                                                                                                      readonly urlCount: number;
                                                                                                                                                                                      • Number of <url> entries seen, including any past maxEntries

                                                                                                                                                                                        Deprecated

                                                                                                                                                                                        Use entryCount

                                                                                                                                                                                      method onAttribute

                                                                                                                                                                                      protected onAttribute: (currentTag: string, attr: QualifiedAttribute) => void;

                                                                                                                                                                                        method onCharData

                                                                                                                                                                                        protected onCharData: (tag: string, text: string) => void;

                                                                                                                                                                                          method onCloseTag

                                                                                                                                                                                          protected onCloseTag: (tag: string) => void;

                                                                                                                                                                                            method onOpenTag

                                                                                                                                                                                            protected onOpenTag: (tag: QualifiedTag) => void;

                                                                                                                                                                                              Interfaces

                                                                                                                                                                                              interface Img

                                                                                                                                                                                              interface Img {}
                                                                                                                                                                                              • Sitemap Image https://support.google.com/webmasters/answer/178636?hl=en&ref_topic=4581190

                                                                                                                                                                                              property caption

                                                                                                                                                                                              caption?: string;
                                                                                                                                                                                              • The caption of the image

                                                                                                                                                                                                Example 1

                                                                                                                                                                                                'Thanksgiving dinner'

                                                                                                                                                                                              property geoLocation

                                                                                                                                                                                              geoLocation?: string;
                                                                                                                                                                                              • The geographic location of the image.

                                                                                                                                                                                                Example 1

                                                                                                                                                                                                'Limerick, Ireland'

                                                                                                                                                                                              property license

                                                                                                                                                                                              license?: string;
                                                                                                                                                                                              • A URL to the license of the image.

                                                                                                                                                                                                Example 1

                                                                                                                                                                                                'https://example.com/license.txt'

                                                                                                                                                                                              property title

                                                                                                                                                                                              title?: string;
                                                                                                                                                                                              • The title of the image

                                                                                                                                                                                                Example 1

                                                                                                                                                                                                'Star Wars EP IV'

                                                                                                                                                                                              property url

                                                                                                                                                                                              url: string;
                                                                                                                                                                                              • The URL of the image

                                                                                                                                                                                                Example 1

                                                                                                                                                                                                'https://example.com/image.jpg'

                                                                                                                                                                                              interface IndexItem

                                                                                                                                                                                              interface IndexItem {}

                                                                                                                                                                                                property lastmod

                                                                                                                                                                                                lastmod?: string;

                                                                                                                                                                                                  property url

                                                                                                                                                                                                  url: string;

                                                                                                                                                                                                    interface IndexObjectStreamToJSONOptions

                                                                                                                                                                                                    interface IndexObjectStreamToJSONOptions extends TransformOptions {}

                                                                                                                                                                                                      property lineSeparated

                                                                                                                                                                                                      lineSeparated: boolean;

                                                                                                                                                                                                        interface LinkItem

                                                                                                                                                                                                        interface LinkItem {}
                                                                                                                                                                                                        • https://support.google.com/webmasters/answer/189077

                                                                                                                                                                                                        property hreflang

                                                                                                                                                                                                        hreflang?: string;
                                                                                                                                                                                                        • Example 1

                                                                                                                                                                                                          'en-us'

                                                                                                                                                                                                        property lang

                                                                                                                                                                                                        lang: string;
                                                                                                                                                                                                        • Example 1

                                                                                                                                                                                                          'en'

                                                                                                                                                                                                        property url

                                                                                                                                                                                                        url: string;

                                                                                                                                                                                                          interface NewsItem

                                                                                                                                                                                                          interface NewsItem {}
                                                                                                                                                                                                          • https://support.google.com/webmasters/answer/74288?hl=en&ref_topic=4581190

                                                                                                                                                                                                          property access

                                                                                                                                                                                                          access?: 'Registration' | 'Subscription';

                                                                                                                                                                                                            property genres

                                                                                                                                                                                                            genres?: string;
                                                                                                                                                                                                            • Example 1

                                                                                                                                                                                                              'PressRelease, Blog'

                                                                                                                                                                                                            property keywords

                                                                                                                                                                                                            keywords?: string;
                                                                                                                                                                                                            • Example 1

                                                                                                                                                                                                              'business, merger, acquisition'

                                                                                                                                                                                                            property publication

                                                                                                                                                                                                            publication: {
                                                                                                                                                                                                            name: string;
                                                                                                                                                                                                            /**
                                                                                                                                                                                                            * The `<language>` is the language of your publication. Use an ISO 639
                                                                                                                                                                                                            * language code (2 or 3 letters).
                                                                                                                                                                                                            */
                                                                                                                                                                                                            language: string;
                                                                                                                                                                                                            };

                                                                                                                                                                                                              property publication_date

                                                                                                                                                                                                              publication_date: string;
                                                                                                                                                                                                              • Article publication date in W3C format, using either the "complete date" (YYYY-MM-DD) format or the "complete date plus hours, minutes, and seconds"

                                                                                                                                                                                                              property stock_tickers

                                                                                                                                                                                                              stock_tickers?: string;
                                                                                                                                                                                                              • Example 1

                                                                                                                                                                                                                'NASDAQ:A, NASDAQ:B'

                                                                                                                                                                                                              property title

                                                                                                                                                                                                              title: string;
                                                                                                                                                                                                              • The title of the news article

                                                                                                                                                                                                                Example 1

                                                                                                                                                                                                                'Companies A, B in Merger Talks'

                                                                                                                                                                                                              interface ObjectStreamToJSONOptions

                                                                                                                                                                                                              interface ObjectStreamToJSONOptions extends TransformOptions {}

                                                                                                                                                                                                                property lineSeparated

                                                                                                                                                                                                                lineSeparated: boolean;

                                                                                                                                                                                                                  interface ReadlineStreamOptions

                                                                                                                                                                                                                  interface ReadlineStreamOptions extends ReadableOptions {}

                                                                                                                                                                                                                    property input

                                                                                                                                                                                                                    input: Readable;

                                                                                                                                                                                                                      interface SaxParserStreamOptions

                                                                                                                                                                                                                      interface SaxParserStreamOptions extends TransformOptions {}
                                                                                                                                                                                                                      • Options shared by the XML parser streams (XMLToSitemapItemStream and XMLToSitemapIndexStream).

                                                                                                                                                                                                                      property level

                                                                                                                                                                                                                      level?: ErrorLevel;

                                                                                                                                                                                                                        property logger

                                                                                                                                                                                                                        logger?: Logger | false;

                                                                                                                                                                                                                          property maxEntries

                                                                                                                                                                                                                          maxEntries?: number;
                                                                                                                                                                                                                          • Maximum number of entries (<url> or <sitemap> elements) to emit. Entries past the cap are dropped and reported once as an error, so untrusted input can't grow memory without bound. A non-negative integer, or Infinity for no cap. 50000 (per sitemaps.org)

                                                                                                                                                                                                                          interface SimpleSitemapAndIndexOptions

                                                                                                                                                                                                                          interface SimpleSitemapAndIndexOptions {}
                                                                                                                                                                                                                          • Options for the simpleSitemapAndIndex function

                                                                                                                                                                                                                          property destinationDir

                                                                                                                                                                                                                          destinationDir: string;
                                                                                                                                                                                                                          • Where to write the sitemaps and index Must be a relative path without path traversal sequences

                                                                                                                                                                                                                          property gzip

                                                                                                                                                                                                                          gzip?: boolean;
                                                                                                                                                                                                                          • Whether to compress the written files true

                                                                                                                                                                                                                          property hostname

                                                                                                                                                                                                                          hostname: string;
                                                                                                                                                                                                                          • The hostname for all URLs Must be a valid http:// or https:// URL

                                                                                                                                                                                                                          property limit

                                                                                                                                                                                                                          limit?: number;
                                                                                                                                                                                                                          • How many URLs to write before switching to a new file Must be between 1 and 50,000 per sitemaps.org spec 45000

                                                                                                                                                                                                                          property logger

                                                                                                                                                                                                                          logger?: Logger | false;
                                                                                                                                                                                                                          • Receives validation warnings from the sitemap and index streams. Defaults to the console; pass false to silence.

                                                                                                                                                                                                                          property publicBasePath

                                                                                                                                                                                                                          publicBasePath?: string;
                                                                                                                                                                                                                          • Where the sitemaps are relative to the hostname. Defaults to root. Must not contain path traversal sequences

                                                                                                                                                                                                                          property sitemapHostname

                                                                                                                                                                                                                          sitemapHostname?: string;
                                                                                                                                                                                                                          • The hostname for the sitemaps if different than hostname Must be a valid http:// or https:// URL

                                                                                                                                                                                                                          property sourceData

                                                                                                                                                                                                                          sourceData: SitemapItemLoose[] | string | Readable | string[];
                                                                                                                                                                                                                          • The urls you want to make a sitemap out of. Can be an array of items, a file path string, a Readable stream, or an array of strings

                                                                                                                                                                                                                          property xslUrl

                                                                                                                                                                                                                          xslUrl?: string;
                                                                                                                                                                                                                          • Optional URL to an XSL stylesheet Must be a valid http:// or https:// URL

                                                                                                                                                                                                                          interface SitemapAndIndexStreamOptions

                                                                                                                                                                                                                          interface SitemapAndIndexStreamOptions extends SitemapIndexStreamOptions {}
                                                                                                                                                                                                                          • Options for the SitemapAndIndexStream

                                                                                                                                                                                                                            {SitemapIndexStreamOptions}

                                                                                                                                                                                                                          property getSitemapStream

                                                                                                                                                                                                                          getSitemapStream: getSitemapStreamFunc;
                                                                                                                                                                                                                          • Callback for SitemapIndexAndStream that creates a new sitemap stream for a given sitemap index.

                                                                                                                                                                                                                            Called when a new sitemap file is needed.

                                                                                                                                                                                                                            The write stream is the destination where the sitemap was piped. SitemapAndIndexStream will wait for the finish event on each sitemap's write stream before moving on to the next sitemap. This ensures that the contents of the write stream will be fully written before being used by any following operations (e.g. uploading, reading contents for unit tests).

                                                                                                                                                                                                                            Parameter i

                                                                                                                                                                                                                            The index of the sitemap file

                                                                                                                                                                                                                            Returns

                                                                                                                                                                                                                            A tuple containing the index item to be written into the sitemap index, the sitemap stream, and the write stream for the sitemap pipe destination

                                                                                                                                                                                                                          property limit

                                                                                                                                                                                                                          limit?: number;
                                                                                                                                                                                                                          • Max number of items in each sitemap XML file.

                                                                                                                                                                                                                            When the limit is reached the current sitemap file will be closed, a wait for finish on the target write stream will happen, and a new sitemap file will be created.

                                                                                                                                                                                                                            Range: 1 - 50,000

                                                                                                                                                                                                                            45000

                                                                                                                                                                                                                          interface SitemapIndexStreamOptions

                                                                                                                                                                                                                          interface SitemapIndexStreamOptions extends TransformOptions {}
                                                                                                                                                                                                                          • Options for the SitemapIndexStream

                                                                                                                                                                                                                          property lastmodDateOnly

                                                                                                                                                                                                                          lastmodDateOnly?: boolean;
                                                                                                                                                                                                                          • Whether to output the lastmod date only (no time)

                                                                                                                                                                                                                            false

                                                                                                                                                                                                                          property level

                                                                                                                                                                                                                          level?: ErrorLevel;
                                                                                                                                                                                                                          • How to handle errors in passed in urls

                                                                                                                                                                                                                            ErrorLevel.WARN

                                                                                                                                                                                                                          property logger

                                                                                                                                                                                                                          logger?: Logger | false;
                                                                                                                                                                                                                          • Receives warnings about invalid index items. Defaults to the console; pass false to silence.

                                                                                                                                                                                                                          property xslUrl

                                                                                                                                                                                                                          xslUrl?: string;
                                                                                                                                                                                                                          • URL to an XSL stylesheet to include in the XML

                                                                                                                                                                                                                          interface SitemapItem

                                                                                                                                                                                                                          interface SitemapItem extends SitemapItemBase {}
                                                                                                                                                                                                                          • Strict options for individual sitemap entries

                                                                                                                                                                                                                          property img

                                                                                                                                                                                                                          img: Img[];
                                                                                                                                                                                                                            links: LinkItem[];

                                                                                                                                                                                                                              property priority

                                                                                                                                                                                                                              priority?: number;

                                                                                                                                                                                                                                property video

                                                                                                                                                                                                                                video: VideoItem[];

                                                                                                                                                                                                                                  interface SitemapItemLoose

                                                                                                                                                                                                                                  interface SitemapItemLoose extends SitemapItemBase {}
                                                                                                                                                                                                                                  • Options for individual sitemap entries prior to normalization

                                                                                                                                                                                                                                  property img

                                                                                                                                                                                                                                  img?: string | Img | (string | Img)[];

                                                                                                                                                                                                                                    property lastmodfile

                                                                                                                                                                                                                                    lastmodfile?: string | Buffer | URL;

                                                                                                                                                                                                                                      property lastmodISO

                                                                                                                                                                                                                                      lastmodISO?: string;

                                                                                                                                                                                                                                        property lastmodrealtime

                                                                                                                                                                                                                                        lastmodrealtime?: boolean;
                                                                                                                                                                                                                                          links?: LinkItem[];

                                                                                                                                                                                                                                            property priority

                                                                                                                                                                                                                                            priority?: number | string;
                                                                                                                                                                                                                                            • A number between 0 and 1. A numeric string such as '0.5' is converted to a number.

                                                                                                                                                                                                                                            property video

                                                                                                                                                                                                                                            video?: VideoItemLoose | VideoItemLoose[];

                                                                                                                                                                                                                                              interface SitemapItemStreamOptions

                                                                                                                                                                                                                                              interface SitemapItemStreamOptions extends TransformOptions {}

                                                                                                                                                                                                                                                property level

                                                                                                                                                                                                                                                level?: ErrorLevel;

                                                                                                                                                                                                                                                  interface SitemapStreamOptions

                                                                                                                                                                                                                                                  interface SitemapStreamOptions extends TransformOptions {}

                                                                                                                                                                                                                                                    property errorHandler

                                                                                                                                                                                                                                                    errorHandler?: ErrorHandler;

                                                                                                                                                                                                                                                      property hostname

                                                                                                                                                                                                                                                      hostname?: string;

                                                                                                                                                                                                                                                        property lastmodDateOnly

                                                                                                                                                                                                                                                        lastmodDateOnly?: boolean;

                                                                                                                                                                                                                                                          property level

                                                                                                                                                                                                                                                          level?: ErrorLevel;

                                                                                                                                                                                                                                                            property logger

                                                                                                                                                                                                                                                            logger?: Logger | false;
                                                                                                                                                                                                                                                            • Receives validation warnings. Defaults to the console; pass false to silence. Ignored for validation when errorHandler is given.

                                                                                                                                                                                                                                                            property xmlns

                                                                                                                                                                                                                                                            xmlns?: NSArgs;

                                                                                                                                                                                                                                                              property xslUrl

                                                                                                                                                                                                                                                              xslUrl?: string;

                                                                                                                                                                                                                                                                interface StringObj

                                                                                                                                                                                                                                                                interface StringObj {}
                                                                                                                                                                                                                                                                • Generic object with string keys and any values Used for XML attribute building and other flexible data structures

                                                                                                                                                                                                                                                                index signature

                                                                                                                                                                                                                                                                [index: string]: any;

                                                                                                                                                                                                                                                                  interface VideoItem

                                                                                                                                                                                                                                                                  interface VideoItem extends VideoItemBase {}
                                                                                                                                                                                                                                                                  • Sitemap video. <https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190>

                                                                                                                                                                                                                                                                  property family_friendly

                                                                                                                                                                                                                                                                  family_friendly?: EnumYesNo;

                                                                                                                                                                                                                                                                    property live

                                                                                                                                                                                                                                                                    live?: EnumYesNo;
                                                                                                                                                                                                                                                                    • Indicates whether the video is a live stream. Supported values are yes or no.

                                                                                                                                                                                                                                                                    property rating

                                                                                                                                                                                                                                                                    rating?: number;
                                                                                                                                                                                                                                                                    • The rating of the video. Supported values are float numbers.

                                                                                                                                                                                                                                                                      Example 1

                                                                                                                                                                                                                                                                      2.5

                                                                                                                                                                                                                                                                    property requires_subscription

                                                                                                                                                                                                                                                                    requires_subscription?: EnumYesNo;
                                                                                                                                                                                                                                                                    • Indicates whether a subscription (either paid or free) is required to view the video. Allowed values are yes or no.

                                                                                                                                                                                                                                                                    property tag

                                                                                                                                                                                                                                                                    tag: string[];
                                                                                                                                                                                                                                                                    • An arbitrary string tag describing the video. Tags are generally very short descriptions of key concepts associated with a video or piece of content.

                                                                                                                                                                                                                                                                      Example 1

                                                                                                                                                                                                                                                                      ['Baking']

                                                                                                                                                                                                                                                                    interface VideoItemLoose

                                                                                                                                                                                                                                                                    interface VideoItemLoose extends VideoItemBase {}
                                                                                                                                                                                                                                                                    • Sitemap video. <https://support.google.com/webmasters/answer/80471?hl=en&ref_topic=4581190>

                                                                                                                                                                                                                                                                    property family_friendly

                                                                                                                                                                                                                                                                    family_friendly?: EnumYesNo | boolean;

                                                                                                                                                                                                                                                                      property live

                                                                                                                                                                                                                                                                      live?: EnumYesNo | boolean;
                                                                                                                                                                                                                                                                      • Indicates whether the video is a live stream. Supported values are yes or no.

                                                                                                                                                                                                                                                                      property rating

                                                                                                                                                                                                                                                                      rating?: string | number;
                                                                                                                                                                                                                                                                      • The rating of the video. Supported values are float numbers.

                                                                                                                                                                                                                                                                        Example 1

                                                                                                                                                                                                                                                                        2.5

                                                                                                                                                                                                                                                                      property requires_subscription

                                                                                                                                                                                                                                                                      requires_subscription?: EnumYesNo | boolean;

                                                                                                                                                                                                                                                                        property tag

                                                                                                                                                                                                                                                                        tag?: string | string[];
                                                                                                                                                                                                                                                                        • An arbitrary string tag describing the video. Tags are generally very short descriptions of key concepts associated with a video or piece of content.

                                                                                                                                                                                                                                                                          Example 1

                                                                                                                                                                                                                                                                          ['Baking']

                                                                                                                                                                                                                                                                        interface XMLToSitemapIndexItemStreamOptions

                                                                                                                                                                                                                                                                        interface XMLToSitemapIndexItemStreamOptions extends SaxParserStreamOptions {}
                                                                                                                                                                                                                                                                        • Options for XMLToSitemapIndexStream

                                                                                                                                                                                                                                                                        interface XMLToSitemapItemStreamOptions

                                                                                                                                                                                                                                                                        interface XMLToSitemapItemStreamOptions extends SaxParserStreamOptions {}
                                                                                                                                                                                                                                                                        • Options for XMLToSitemapItemStream

                                                                                                                                                                                                                                                                        Enums

                                                                                                                                                                                                                                                                        enum EnumAllowDeny

                                                                                                                                                                                                                                                                        enum EnumAllowDeny {
                                                                                                                                                                                                                                                                        ALLOW = 'allow',
                                                                                                                                                                                                                                                                        DENY = 'deny',
                                                                                                                                                                                                                                                                        }

                                                                                                                                                                                                                                                                          member ALLOW

                                                                                                                                                                                                                                                                          ALLOW = 'allow'

                                                                                                                                                                                                                                                                            member DENY

                                                                                                                                                                                                                                                                            DENY = 'deny'

                                                                                                                                                                                                                                                                              enum EnumChangefreq

                                                                                                                                                                                                                                                                              enum EnumChangefreq {
                                                                                                                                                                                                                                                                              DAILY = 'daily',
                                                                                                                                                                                                                                                                              MONTHLY = 'monthly',
                                                                                                                                                                                                                                                                              ALWAYS = 'always',
                                                                                                                                                                                                                                                                              HOURLY = 'hourly',
                                                                                                                                                                                                                                                                              WEEKLY = 'weekly',
                                                                                                                                                                                                                                                                              YEARLY = 'yearly',
                                                                                                                                                                                                                                                                              NEVER = 'never',
                                                                                                                                                                                                                                                                              }
                                                                                                                                                                                                                                                                              • How frequently the page is likely to change. This value provides general information to search engines and may not correlate exactly to how often they crawl the page. Please note that the value of this tag is considered a hint and not a command. See <https://www.sitemaps.org/protocol.html#xmlTagDefinitions> for the acceptable values

                                                                                                                                                                                                                                                                              member ALWAYS

                                                                                                                                                                                                                                                                              ALWAYS = 'always'

                                                                                                                                                                                                                                                                                member DAILY

                                                                                                                                                                                                                                                                                DAILY = 'daily'

                                                                                                                                                                                                                                                                                  member HOURLY

                                                                                                                                                                                                                                                                                  HOURLY = 'hourly'

                                                                                                                                                                                                                                                                                    member MONTHLY

                                                                                                                                                                                                                                                                                    MONTHLY = 'monthly'

                                                                                                                                                                                                                                                                                      member NEVER

                                                                                                                                                                                                                                                                                      NEVER = 'never'

                                                                                                                                                                                                                                                                                        member WEEKLY

                                                                                                                                                                                                                                                                                        WEEKLY = 'weekly'

                                                                                                                                                                                                                                                                                          member YEARLY

                                                                                                                                                                                                                                                                                          YEARLY = 'yearly'

                                                                                                                                                                                                                                                                                            enum EnumYesNo

                                                                                                                                                                                                                                                                                            enum EnumYesNo {
                                                                                                                                                                                                                                                                                            YES = 'YES',
                                                                                                                                                                                                                                                                                            NO = 'NO',
                                                                                                                                                                                                                                                                                            Yes = 'Yes',
                                                                                                                                                                                                                                                                                            No = 'No',
                                                                                                                                                                                                                                                                                            yes = 'yes',
                                                                                                                                                                                                                                                                                            no = 'no',
                                                                                                                                                                                                                                                                                            }

                                                                                                                                                                                                                                                                                              member no

                                                                                                                                                                                                                                                                                              no = 'no'

                                                                                                                                                                                                                                                                                                member No

                                                                                                                                                                                                                                                                                                No = 'No'

                                                                                                                                                                                                                                                                                                  member NO

                                                                                                                                                                                                                                                                                                  NO = 'NO'

                                                                                                                                                                                                                                                                                                    member yes

                                                                                                                                                                                                                                                                                                    yes = 'yes'

                                                                                                                                                                                                                                                                                                      member Yes

                                                                                                                                                                                                                                                                                                      Yes = 'Yes'

                                                                                                                                                                                                                                                                                                        member YES

                                                                                                                                                                                                                                                                                                        YES = 'YES'

                                                                                                                                                                                                                                                                                                          enum ErrorLevel

                                                                                                                                                                                                                                                                                                          enum ErrorLevel {
                                                                                                                                                                                                                                                                                                          SILENT = 'silent',
                                                                                                                                                                                                                                                                                                          WARN = 'warn',
                                                                                                                                                                                                                                                                                                          THROW = 'throw',
                                                                                                                                                                                                                                                                                                          }
                                                                                                                                                                                                                                                                                                          • How to handle errors in passed in urls

                                                                                                                                                                                                                                                                                                          member SILENT

                                                                                                                                                                                                                                                                                                          SILENT = 'silent'
                                                                                                                                                                                                                                                                                                          • Validation will be skipped and nothing logged or thrown.

                                                                                                                                                                                                                                                                                                          member THROW

                                                                                                                                                                                                                                                                                                          THROW = 'throw'
                                                                                                                                                                                                                                                                                                          • An Error will be thrown on encountering invalid data.

                                                                                                                                                                                                                                                                                                          member WARN

                                                                                                                                                                                                                                                                                                          WARN = 'warn'
                                                                                                                                                                                                                                                                                                          • If an invalid value is encountered, the stream's logger is called with details (console.warn by default)

                                                                                                                                                                                                                                                                                                          enum IndexTagNames

                                                                                                                                                                                                                                                                                                          enum IndexTagNames {
                                                                                                                                                                                                                                                                                                          sitemap = 'sitemap',
                                                                                                                                                                                                                                                                                                          sitemapindex = 'sitemapindex',
                                                                                                                                                                                                                                                                                                          loc = 'loc',
                                                                                                                                                                                                                                                                                                          lastmod = 'lastmod',
                                                                                                                                                                                                                                                                                                          }

                                                                                                                                                                                                                                                                                                            member lastmod

                                                                                                                                                                                                                                                                                                            lastmod = 'lastmod'

                                                                                                                                                                                                                                                                                                              member loc

                                                                                                                                                                                                                                                                                                              loc = 'loc'

                                                                                                                                                                                                                                                                                                                member sitemap

                                                                                                                                                                                                                                                                                                                sitemap = 'sitemap'

                                                                                                                                                                                                                                                                                                                  member sitemapindex

                                                                                                                                                                                                                                                                                                                  sitemapindex = 'sitemapindex'

                                                                                                                                                                                                                                                                                                                    enum TagNames

                                                                                                                                                                                                                                                                                                                    enum TagNames {
                                                                                                                                                                                                                                                                                                                    url = 'url',
                                                                                                                                                                                                                                                                                                                    loc = 'loc',
                                                                                                                                                                                                                                                                                                                    urlset = 'urlset',
                                                                                                                                                                                                                                                                                                                    lastmod = 'lastmod',
                                                                                                                                                                                                                                                                                                                    changefreq = 'changefreq',
                                                                                                                                                                                                                                                                                                                    priority = 'priority',
                                                                                                                                                                                                                                                                                                                    'video:thumbnail_loc' = 'video:thumbnail_loc',
                                                                                                                                                                                                                                                                                                                    'video:video' = 'video:video',
                                                                                                                                                                                                                                                                                                                    'video:title' = 'video:title',
                                                                                                                                                                                                                                                                                                                    'video:description' = 'video:description',
                                                                                                                                                                                                                                                                                                                    'video:tag' = 'video:tag',
                                                                                                                                                                                                                                                                                                                    'video:duration' = 'video:duration',
                                                                                                                                                                                                                                                                                                                    'video:player_loc' = 'video:player_loc',
                                                                                                                                                                                                                                                                                                                    'video:content_loc' = 'video:content_loc',
                                                                                                                                                                                                                                                                                                                    'image:image' = 'image:image',
                                                                                                                                                                                                                                                                                                                    'image:loc' = 'image:loc',
                                                                                                                                                                                                                                                                                                                    'image:geo_location' = 'image:geo_location',
                                                                                                                                                                                                                                                                                                                    'image:license' = 'image:license',
                                                                                                                                                                                                                                                                                                                    'image:title' = 'image:title',
                                                                                                                                                                                                                                                                                                                    'image:caption' = 'image:caption',
                                                                                                                                                                                                                                                                                                                    'video:requires_subscription' = 'video:requires_subscription',
                                                                                                                                                                                                                                                                                                                    'video:publication_date' = 'video:publication_date',
                                                                                                                                                                                                                                                                                                                    'video:id' = 'video:id',
                                                                                                                                                                                                                                                                                                                    'video:restriction' = 'video:restriction',
                                                                                                                                                                                                                                                                                                                    'video:family_friendly' = 'video:family_friendly',
                                                                                                                                                                                                                                                                                                                    'video:view_count' = 'video:view_count',
                                                                                                                                                                                                                                                                                                                    'video:uploader' = 'video:uploader',
                                                                                                                                                                                                                                                                                                                    'video:expiration_date' = 'video:expiration_date',
                                                                                                                                                                                                                                                                                                                    'video:platform' = 'video:platform',
                                                                                                                                                                                                                                                                                                                    'video:price' = 'video:price',
                                                                                                                                                                                                                                                                                                                    'video:rating' = 'video:rating',
                                                                                                                                                                                                                                                                                                                    'video:category' = 'video:category',
                                                                                                                                                                                                                                                                                                                    'video:live' = 'video:live',
                                                                                                                                                                                                                                                                                                                    'video:gallery_loc' = 'video:gallery_loc',
                                                                                                                                                                                                                                                                                                                    'news:news' = 'news:news',
                                                                                                                                                                                                                                                                                                                    'news:publication' = 'news:publication',
                                                                                                                                                                                                                                                                                                                    'news:name' = 'news:name',
                                                                                                                                                                                                                                                                                                                    'news:access' = 'news:access',
                                                                                                                                                                                                                                                                                                                    'news:genres' = 'news:genres',
                                                                                                                                                                                                                                                                                                                    'news:publication_date' = 'news:publication_date',
                                                                                                                                                                                                                                                                                                                    'news:title' = 'news:title',
                                                                                                                                                                                                                                                                                                                    'news:keywords' = 'news:keywords',
                                                                                                                                                                                                                                                                                                                    'news:stock_tickers' = 'news:stock_tickers',
                                                                                                                                                                                                                                                                                                                    'news:language' = 'news:language',
                                                                                                                                                                                                                                                                                                                    'mobile:mobile' = 'mobile:mobile',
                                                                                                                                                                                                                                                                                                                    'xhtml:link' = 'xhtml:link',
                                                                                                                                                                                                                                                                                                                    expires = 'expires',
                                                                                                                                                                                                                                                                                                                    }

                                                                                                                                                                                                                                                                                                                      member 'image:caption'

                                                                                                                                                                                                                                                                                                                      'image:caption' = 'image:caption'

                                                                                                                                                                                                                                                                                                                        member 'image:geo_location'

                                                                                                                                                                                                                                                                                                                        'image:geo_location' = 'image:geo_location'

                                                                                                                                                                                                                                                                                                                          member 'image:image'

                                                                                                                                                                                                                                                                                                                          'image:image' = 'image:image'

                                                                                                                                                                                                                                                                                                                            member 'image:license'

                                                                                                                                                                                                                                                                                                                            'image:license' = 'image:license'

                                                                                                                                                                                                                                                                                                                              member 'image:loc'

                                                                                                                                                                                                                                                                                                                              'image:loc' = 'image:loc'

                                                                                                                                                                                                                                                                                                                                member 'image:title'

                                                                                                                                                                                                                                                                                                                                'image:title' = 'image:title'

                                                                                                                                                                                                                                                                                                                                  member 'mobile:mobile'

                                                                                                                                                                                                                                                                                                                                  'mobile:mobile' = 'mobile:mobile'

                                                                                                                                                                                                                                                                                                                                    member 'news:access'

                                                                                                                                                                                                                                                                                                                                    'news:access' = 'news:access'

                                                                                                                                                                                                                                                                                                                                      member 'news:genres'

                                                                                                                                                                                                                                                                                                                                      'news:genres' = 'news:genres'

                                                                                                                                                                                                                                                                                                                                        member 'news:keywords'

                                                                                                                                                                                                                                                                                                                                        'news:keywords' = 'news:keywords'

                                                                                                                                                                                                                                                                                                                                          member 'news:language'

                                                                                                                                                                                                                                                                                                                                          'news:language' = 'news:language'

                                                                                                                                                                                                                                                                                                                                            member 'news:name'

                                                                                                                                                                                                                                                                                                                                            'news:name' = 'news:name'

                                                                                                                                                                                                                                                                                                                                              member 'news:news'

                                                                                                                                                                                                                                                                                                                                              'news:news' = 'news:news'

                                                                                                                                                                                                                                                                                                                                                member 'news:publication_date'

                                                                                                                                                                                                                                                                                                                                                'news:publication_date' = 'news:publication_date'

                                                                                                                                                                                                                                                                                                                                                  member 'news:publication'

                                                                                                                                                                                                                                                                                                                                                  'news:publication' = 'news:publication'

                                                                                                                                                                                                                                                                                                                                                    member 'news:stock_tickers'

                                                                                                                                                                                                                                                                                                                                                    'news:stock_tickers' = 'news:stock_tickers'

                                                                                                                                                                                                                                                                                                                                                      member 'news:title'

                                                                                                                                                                                                                                                                                                                                                      'news:title' = 'news:title'

                                                                                                                                                                                                                                                                                                                                                        member 'video:category'

                                                                                                                                                                                                                                                                                                                                                        'video:category' = 'video:category'

                                                                                                                                                                                                                                                                                                                                                          member 'video:content_loc'

                                                                                                                                                                                                                                                                                                                                                          'video:content_loc' = 'video:content_loc'

                                                                                                                                                                                                                                                                                                                                                            member 'video:description'

                                                                                                                                                                                                                                                                                                                                                            'video:description' = 'video:description'

                                                                                                                                                                                                                                                                                                                                                              member 'video:duration'

                                                                                                                                                                                                                                                                                                                                                              'video:duration' = 'video:duration'

                                                                                                                                                                                                                                                                                                                                                                member 'video:expiration_date'

                                                                                                                                                                                                                                                                                                                                                                'video:expiration_date' = 'video:expiration_date'

                                                                                                                                                                                                                                                                                                                                                                  member 'video:family_friendly'

                                                                                                                                                                                                                                                                                                                                                                  'video:family_friendly' = 'video:family_friendly'

                                                                                                                                                                                                                                                                                                                                                                    member 'video:gallery_loc'

                                                                                                                                                                                                                                                                                                                                                                    'video:gallery_loc' = 'video:gallery_loc'

                                                                                                                                                                                                                                                                                                                                                                      member 'video:id'

                                                                                                                                                                                                                                                                                                                                                                      'video:id' = 'video:id'

                                                                                                                                                                                                                                                                                                                                                                        member 'video:live'

                                                                                                                                                                                                                                                                                                                                                                        'video:live' = 'video:live'

                                                                                                                                                                                                                                                                                                                                                                          member 'video:platform'

                                                                                                                                                                                                                                                                                                                                                                          'video:platform' = 'video:platform'

                                                                                                                                                                                                                                                                                                                                                                            member 'video:player_loc'

                                                                                                                                                                                                                                                                                                                                                                            'video:player_loc' = 'video:player_loc'

                                                                                                                                                                                                                                                                                                                                                                              member 'video:price'

                                                                                                                                                                                                                                                                                                                                                                              'video:price' = 'video:price'

                                                                                                                                                                                                                                                                                                                                                                                member 'video:publication_date'

                                                                                                                                                                                                                                                                                                                                                                                'video:publication_date' = 'video:publication_date'

                                                                                                                                                                                                                                                                                                                                                                                  member 'video:rating'

                                                                                                                                                                                                                                                                                                                                                                                  'video:rating' = 'video:rating'

                                                                                                                                                                                                                                                                                                                                                                                    member 'video:requires_subscription'

                                                                                                                                                                                                                                                                                                                                                                                    'video:requires_subscription' = 'video:requires_subscription'

                                                                                                                                                                                                                                                                                                                                                                                      member 'video:restriction'

                                                                                                                                                                                                                                                                                                                                                                                      'video:restriction' = 'video:restriction'

                                                                                                                                                                                                                                                                                                                                                                                        member 'video:tag'

                                                                                                                                                                                                                                                                                                                                                                                        'video:tag' = 'video:tag'

                                                                                                                                                                                                                                                                                                                                                                                          member 'video:thumbnail_loc'

                                                                                                                                                                                                                                                                                                                                                                                          'video:thumbnail_loc' = 'video:thumbnail_loc'

                                                                                                                                                                                                                                                                                                                                                                                            member 'video:title'

                                                                                                                                                                                                                                                                                                                                                                                            'video:title' = 'video:title'

                                                                                                                                                                                                                                                                                                                                                                                              member 'video:uploader'

                                                                                                                                                                                                                                                                                                                                                                                              'video:uploader' = 'video:uploader'

                                                                                                                                                                                                                                                                                                                                                                                                member 'video:video'

                                                                                                                                                                                                                                                                                                                                                                                                'video:video' = 'video:video'

                                                                                                                                                                                                                                                                                                                                                                                                  member 'video:view_count'

                                                                                                                                                                                                                                                                                                                                                                                                  'video:view_count' = 'video:view_count'

                                                                                                                                                                                                                                                                                                                                                                                                    member 'xhtml:link'

                                                                                                                                                                                                                                                                                                                                                                                                    'xhtml:link' = 'xhtml:link'

                                                                                                                                                                                                                                                                                                                                                                                                      member changefreq

                                                                                                                                                                                                                                                                                                                                                                                                      changefreq = 'changefreq'

                                                                                                                                                                                                                                                                                                                                                                                                        member expires

                                                                                                                                                                                                                                                                                                                                                                                                        expires = 'expires'

                                                                                                                                                                                                                                                                                                                                                                                                          member lastmod

                                                                                                                                                                                                                                                                                                                                                                                                          lastmod = 'lastmod'

                                                                                                                                                                                                                                                                                                                                                                                                            member loc

                                                                                                                                                                                                                                                                                                                                                                                                            loc = 'loc'

                                                                                                                                                                                                                                                                                                                                                                                                              member priority

                                                                                                                                                                                                                                                                                                                                                                                                              priority = 'priority'

                                                                                                                                                                                                                                                                                                                                                                                                                member url

                                                                                                                                                                                                                                                                                                                                                                                                                url = 'url'

                                                                                                                                                                                                                                                                                                                                                                                                                  member urlset

                                                                                                                                                                                                                                                                                                                                                                                                                  urlset = 'urlset'

                                                                                                                                                                                                                                                                                                                                                                                                                    Type Aliases

                                                                                                                                                                                                                                                                                                                                                                                                                    type ErrorHandler

                                                                                                                                                                                                                                                                                                                                                                                                                    type ErrorHandler = (error: Error, level: ErrorLevel) => void;

                                                                                                                                                                                                                                                                                                                                                                                                                      type Logger

                                                                                                                                                                                                                                                                                                                                                                                                                      type Logger = (
                                                                                                                                                                                                                                                                                                                                                                                                                      level: 'warn' | 'error' | 'info' | 'log',
                                                                                                                                                                                                                                                                                                                                                                                                                      ...message: Parameters<Console['log']>
                                                                                                                                                                                                                                                                                                                                                                                                                      ) => void;
                                                                                                                                                                                                                                                                                                                                                                                                                      • Receives every message the library would otherwise print to the console. Pass one as the logger option of any stream, or pass false to silence it.

                                                                                                                                                                                                                                                                                                                                                                                                                      type PriceType

                                                                                                                                                                                                                                                                                                                                                                                                                      type PriceType = 'rent' | 'purchase' | 'RENT' | 'PURCHASE';
                                                                                                                                                                                                                                                                                                                                                                                                                      • Video price type - supports both lowercase and uppercase variants as allowed by the Google Video Sitemap specification

                                                                                                                                                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                                                                                                                                                        • https://developers.google.com/search/docs/advanced/sitemaps/video-sitemaps

                                                                                                                                                                                                                                                                                                                                                                                                                      type Resolution

                                                                                                                                                                                                                                                                                                                                                                                                                      type Resolution = 'HD' | 'hd' | 'sd' | 'SD';
                                                                                                                                                                                                                                                                                                                                                                                                                      • Video resolution - supports both lowercase and uppercase variants as allowed by the Google Video Sitemap specification

                                                                                                                                                                                                                                                                                                                                                                                                                        See Also

                                                                                                                                                                                                                                                                                                                                                                                                                        • https://developers.google.com/search/docs/advanced/sitemaps/video-sitemaps

                                                                                                                                                                                                                                                                                                                                                                                                                      Package Files (13)

                                                                                                                                                                                                                                                                                                                                                                                                                      Dependencies (3)

                                                                                                                                                                                                                                                                                                                                                                                                                      Dev Dependencies (18)

                                                                                                                                                                                                                                                                                                                                                                                                                      Peer Dependencies (0)

                                                                                                                                                                                                                                                                                                                                                                                                                      No peer dependencies.

                                                                                                                                                                                                                                                                                                                                                                                                                      Badge

                                                                                                                                                                                                                                                                                                                                                                                                                      To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

                                                                                                                                                                                                                                                                                                                                                                                                                      You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/sitemap.

                                                                                                                                                                                                                                                                                                                                                                                                                      • Markdown
                                                                                                                                                                                                                                                                                                                                                                                                                        [![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/sitemap)
                                                                                                                                                                                                                                                                                                                                                                                                                      • HTML
                                                                                                                                                                                                                                                                                                                                                                                                                        <a href="https://www.jsdocs.io/package/sitemap"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>