import { IndexEntry, Query } from './repoIndex';
export interface Downloader {
    /**
     * Path to the cache directory where the repository index and binaries are stored.
     *
     * Defaults to `.cache/nginx-binaries/` relative to the nearest writable `node_modules`
     * (nearest to `process.cwd()`) or `nginx-binaries/` in the system-preferred temp
     * directory.
     */
    cacheDir: string;
    /**
     * Maximum age in minutes for the cached repository index in `cacheDir` to be
     * considered fresh. If the cached index is stale, the Downloader tries to refresh
     * it before reading.
     *
     * @default 480 (8 hours)
     */
    cacheMaxAge: number;
    /**
     * URL of the repository with binaries.
     *
     * **Caution:** After changing `repoUrl`, you should delete old `index.json` in
     * `cacheDir` or disable index cache by setting `cacheMaxAge` to `0`.
     *
     * @default 'https://jirutka.github.io/nginx-binaries'
     */
    repoUrl: string;
    /**
     * Fetch response timeout in milliseconds.
     *
     * @default 10000
     */
    timeout: number;
    /**
     * Downloads a binary specified by `query` and stores it in the `cacheDir` or
     * in `destFilePath`, if provided. Returns path to the file.
     *
     * If the file already exists and the checksums match, it just returns its path.
     *
     * If multiple versions satisfies the version range, the one with highest
     * version number is selected.
     *
     * @param query A query that specifies what binary to download.
     * @param destFilePath An optional file path where to write the downloaded binary.
     * @return Path to the downloaded binary on the filesystem.
     * @throws {RangeError} if no matching binary is found.
     */
    download: (query: Query, destFilePath?: string) => Promise<string>;
    /**
     * Returns metadata of available binaries that match the query.
     */
    search: (query: Query) => Promise<IndexEntry[]>;
    /**
     * Returns all the available variants matching the query.
     */
    variants: (query?: Query) => Promise<string[]>;
    /**
     * Returns all the available versions matching the query.
     */
    versions: (query?: Query) => Promise<string[]>;
}
export declare const createDownloader: (name: string) => Downloader;
//# sourceMappingURL=downloader.d.ts.map