electron-dl-manager
Version:
A library for implementing file downloads in Electron with 'save as' dialog and id support.
41 lines (40 loc) • 1.27 kB
TypeScript
import type { DownloadData } from "./DownloadData";
import type { DebugLoggerFn, DownloadConfig, DownloadManagerConstructorParams, IElectronDownloadManager } from "./types";
/**
* Enables handling downloads in Electron.
*/
export declare class ElectronDownloadManager implements IElectronDownloadManager {
protected downloadData: Record<string, DownloadData>;
protected logger: DebugLoggerFn;
private downloadQueue;
constructor(params?: DownloadManagerConstructorParams);
protected log(message: string): void;
/**
* Returns the current download data
*/
getDownloadData(id: string): DownloadData;
/**
* Cancels a download
*/
cancelDownload(id: string): void;
/**
* Pauses a download
*/
pauseDownload(id: string): void;
/**
* Resumes a download
*/
resumeDownload(id: string): void;
/**
* Returns the number of active downloads
*/
getActiveDownloadCount(): number;
/**
* Starts a download. If saveDialogOptions has been defined in the config,
* the saveAs dialog will show up first.
*
* Returns the id of the download.
*/
download(params: DownloadConfig): Promise<string>;
protected cleanup(data: DownloadData): void;
}