/// <reference types="node" />
import { ChildProcess } from 'child_process';
import nodeFetch, { RequestInit, Response } from 'node-fetch';
/**
 * Promisified fs.readFile
 */
export declare function readFile(file: string): Promise<string>;
/**
 * Promisified fs.writeFile
 */
export declare function writeFile(file: string, contents: string | Buffer): Promise<void>;
/**
 * Copies a file from one place to another.
 */
export declare function copy(source: string, destination: string): Promise<void>;
/**
 * Promisified fs.exists
 */
export declare function exists(file: string): Promise<boolean>;
/**
 * Promisified fs.readDir
 */
export declare function readDir(dir: string): Promise<string[]>;
/**
 * Takes a function that wants a callback, and resolves when that callback
 * is resolved upon or errored.
 */
export declare function promiseCallback<R = any>(fn: (callback: (err?: Error, result?: R) => void) => void): Promise<R>;
/**
 * Waits for the child process to exit. Buffers output and throws it on a
 * non-zero exit code.
 */
export declare function awaitChildProcess(child: ChildProcess): Promise<void>;
/**
 * Returns a promise that resolves after the given duration.
 */
export declare function delay(duration: number): Promise<void>;
/**
 * Returns a promise that never resolves.
 */
export declare function never(): Promise<never>;
/**
 * Wraps the error message, preserving its original stacktrace and adding
 * extra information.
 */
export declare function wrapErr(err: Error, message: string): Error;
/**
 * IFetchPolicy defines an interface that can augment a fetcher.
 */
export interface IFetchPolicy {
    /**
     * Returns one or more headers to add to outgoing requests.
     */
    header(): {
        [key: string]: string;
    };
}
export declare type HttpMethod = 'get' | 'post' | 'put' | 'patch';
/**
 * IRequester is an interface for a type that makes fetch requests.
 */
export interface IRequester {
    with(...policies: IFetchPolicy[]): IRequester;
    json(method: HttpMethod, path: string, body?: object): Promise<Response>;
    run(path: string, init?: RequestInit): Promise<Response>;
}
/**
 * Returns a path to the Mixer API.
 */
export declare function api(): string;
/**
 * Fetcher is a concrete, node-fetch-based implementation of IRequester.
 */
export declare class Fetcher implements IRequester {
    private readonly policies;
    private readonly host;
    private readonly fetch;
    constructor(policies?: IFetchPolicy[], host?: string, fetch?: typeof nodeFetch);
    /**
     * Returns a new fetcher with the provided policies applied.
     */
    with(...policies: IFetchPolicy[]): IRequester;
    /**
     * Makes a request with a JSON body to the give path.
     */
    json(method: HttpMethod, path: string, body?: object): Promise<Response>;
    /**
     * Makes a generic HTTP request to the given path.
     */
    run(path: string, init?: RequestInit): Promise<Response>;
}
