///
import type { IncomingMessage } from 'http';
import downloadFile from 'download';
export interface Options {
options?: downloadFile.DownloadOptions;
onDownloadProgress?(args: Omit): void;
onResponse?(response: IncomingMessage): void;
onError?(args: {
error: Error;
url: string;
}): void;
onEnd?(): void;
}
export interface DownloadProgress {
percent: string;
total: number;
transferred: number;
}
export interface DownloadObject extends DownloadProgress {
state: 'initiating' | 'downloading' | 'downloaded' | 'error';
url: string;
}
declare function useDownload({ onDownloadProgress: onDownloadProgressProp, onError: onErrorProp, onEnd: onEndProp, onResponse: onResponseProp, options: optionsProp, }?: Options): {
download: ({ destination, label, prefix, url, onDownloadProgress, onEnd, onError, onResponse, options, }: {
destination?: string;
label?: string;
prefix?: string;
url: string;
} & Pick) => Promise;
initiating: Record;
downloading: Record;
downloaded: Record;
urlsInProgress: string[];
urlsDownloaded: string[];
};
export default useDownload;