async-downloader
Version:
A lightweight, threaded resource download helper leveraging web workers
18 lines (17 loc) • 616 B
TypeScript
import { DownloadProgressCallback } from './types';
declare type ReturnTypeOption = 'blob' | 'uri';
declare type ReturnType = Blob | string;
interface DownloaderOptions {
returnType?: ReturnTypeOption;
workerUrl?: string;
}
declare class Downloader {
private readonly workerUrl;
private readonly hasWorkers;
private readonly returnType;
constructor({ returnType, workerUrl }?: DownloaderOptions);
download(resourceUri: string, onDownloadProgress?: DownloadProgressCallback): Promise<ReturnType>;
private formatResult;
private checkWorkerAvailability;
}
export default Downloader;