Magpie HTML - v0.2.4
    Preparing search index...

    Interface GatherOptions

    Options for high-level gather functions.

    Forwarded to the underlying pluck fetch, so every PluckInit option is supported (timeout, headers, userAgent, maxRedirects, maxSize, …). All options are optional; calling a gather function without options keeps the existing defaults.

    const article = await gatherArticle('https://example.com/article', {
    timeout: 12_000,
    headers: { 'User-Agent': 'MyBot/1.0' },
    });
    interface GatherOptions {
        timeout?: number;
        maxRedirects?: number;
        maxSize?: number;
        userAgent?: string;
        throwOnHttpError?: boolean;
        strictContentType?: boolean;
        allowedContentTypes?: string[];
        followRedirects?: boolean;
        validateEncoding?: boolean;
    }

    Hierarchy (View Summary)

    Index

    Properties

    timeout?: number

    Request timeout in milliseconds.

    30000 (30 seconds)
    
    maxRedirects?: number

    Maximum number of redirects to follow.

    10
    
    maxSize?: number

    Maximum response size in bytes.

    10485760 (10MB)
    
    userAgent?: string

    User-Agent header shortcut.

    Convenience property that sets the User-Agent header. Overrides any User-Agent in the headers object.

    throwOnHttpError?: boolean

    Throw error on HTTP error status (4xx, 5xx).

    true
    
    strictContentType?: boolean

    Validate Content-Type header.

    If true, throws error if Content-Type is not in allowedContentTypes.

    false
    
    allowedContentTypes?: string[]

    Allowed Content-Type values for strictContentType.

    ['text/html', 'text/xml', 'application/xml', 'application/xhtml+xml', 'application/rss+xml', 'application/atom+xml', 'application/json']
    
    followRedirects?: boolean

    Follow redirects automatically.

    If false, returns the 3xx response directly without following.

    true
    
    validateEncoding?: boolean

    Validate detected encoding.

    If true, throws error if detected encoding is invalid or unsupported.

    true