class CompositeFetcher
implements IContentFetcher

Combines multiple fetchers, trying each in order. First fetcher that can handle the source wins.

Constructors

new
CompositeFetcher(fetchers: IContentFetcher[])

Creates a new CompositeFetcher

Properties

private
readonly
fetchers: IContentFetcher[]

Methods

addFetcher(
fetcher: IContentFetcher,
priority?: boolean,
): void

Adds a fetcher to the chain.

canHandle(source: string): boolean

Checks if any fetcher can handle the given source.

fetch(source: string): Promise<string>

Fetches content using the first fetcher that can handle the source.

Usage

import { CompositeFetcher } from ".";