class FilterDownloader

Native Deno filter downloader

Constructors

new
FilterDownloader(
logger?: ILogger,
)

Creates a new FilterDownloader

Static Methods

download(
source: string,
additionalOptions?: { allowEmptyResponse?: boolean; },
): Promise<string[]>

Static convenience method for one-off downloads

Properties

private
readonly
circuitBreakers: Map<string, CircuitBreaker>
private
readonly
logger: ILogger
private
readonly
options: Required<DownloaderOptions>
private
readonly
visitedUrls: Set<string>

Methods

download(source: string): Promise<string[]>

Downloads and processes a filter list from a URL or file path

private
downloadInternal(
source: string,
depth: number,
): Promise<string[]>

Internal download method with include depth tracking

private
fetchUrl(url: string): Promise<string>

Fetches content from a URL with retry logic and circuit breaker

private
findEndIfIndex(
lines: string[],
startIndex: number,
): number

Finds the index of the matching !#endif for a !#if at startIndex

private
getCircuitBreaker(url: string): CircuitBreaker | null

Gets or creates a circuit breaker for a URL

getCircuitBreakerStats(): Map<string, ReturnType<CircuitBreaker["getStats"]>>

Gets circuit breaker statistics for all URLs Useful for monitoring and debugging

private
parseConditionalBlock(
lines: string[],
startIndex: number,
): ConditionalBlock

Parses a conditional block (!#if ... !#else ... !#endif)

private
processDirectives(
lines: string[],
basePath: string,
depth: number,
): Promise<string[]>

Processes preprocessor directives in the filter content

private
readFile(path: string): Promise<string>

Reads content from a local file

Resets all circuit breakers Useful for manual recovery or testing