UNPKG

2.25 kBTypeScriptView Raw
1/// <reference types="node" />
2import { Readable, ReadableOptions, TransformOptions } from 'stream';
3import { SitemapItem, ErrorLevel, SitemapItemLoose, ErrorHandler } from './types';
4/**
5 * Verifies all data passed in will comply with sitemap spec.
6 * @param conf Options to validate
7 * @param level logging level
8 * @param errorHandler error handling func
9 */
10export declare function validateSMIOptions(conf: SitemapItem, level?: ErrorLevel, errorHandler?: ErrorHandler): SitemapItem;
11/**
12 * Combines multiple streams into one
13 * @param streams the streams to combine
14 */
15export declare function mergeStreams(streams: Readable[], options?: TransformOptions): Readable;
16export interface ReadlineStreamOptions extends ReadableOptions {
17 input: Readable;
18}
19/**
20 * Wraps node's ReadLine in a stream
21 */
22export declare class ReadlineStream extends Readable {
23 private _source;
24 constructor(options: ReadlineStreamOptions);
25 _read(size: number): void;
26}
27/**
28 * Takes a stream likely from fs.createReadStream('./path') and returns a stream
29 * of sitemap items
30 * @param stream a stream of line separated urls.
31 * @param opts.isJSON is the stream line separated JSON. leave undefined to guess
32 */
33export declare function lineSeparatedURLsToSitemapOptions(stream: Readable, { isJSON }?: {
34 isJSON?: boolean;
35}): Readable;
36/**
37 * Based on lodash's implementation of chunk.
38 *
39 * Copyright JS Foundation and other contributors <https://js.foundation/>
40 *
41 * Based on Underscore.js, copyright Jeremy Ashkenas,
42 * DocumentCloud and Investigative Reporters & Editors <http://underscorejs.org/>
43 *
44 * This software consists of voluntary contributions made by many
45 * individuals. For exact contribution history, see the revision history
46 * available at https://github.com/lodash/lodash
47 */
48export declare function chunk(array: any[], size?: number): any[];
49/**
50 * Converts the passed in sitemap entry into one capable of being consumed by SitemapItem
51 * @param {string | SitemapItemLoose} elem the string or object to be converted
52 * @param {string} hostname
53 * @returns SitemapItemOptions a strict sitemap item option
54 */
55export declare function normalizeURL(elem: string | SitemapItemLoose, hostname?: string, lastmodDateOnly?: boolean): SitemapItem;