import { TypedEventTarget } from 'typescript-event-target'; export declare const EtaStatus: Readonly<{ Idle: 0; Paused: 1; Running: 2; }>; type TEtaStatus = typeof EtaStatus[keyof typeof EtaStatus]; interface EtaOptions { /** Low pass filter cutoff time for smoothing the speed */ cutoffTime?: number; /** Total number of bytes to be expected */ total?: number; /** Start the estimation directly */ start?: boolean; } export interface EtaEventsMap { pause: CustomEvent; reset: CustomEvent; resume: CustomEvent; update: CustomEvent; } export declare class Eta extends TypedEventTarget { /** Bytes done */ private _done; /** Total bytes to do */ private _total; /** Current progress (cached) as interval [0,1] */ private _progress; /** Status of the ETA */ private _status; /** Time of the last update */ private _startTime; /** Total elapsed time for current ETA */ private _elapsedTime; /** Current speed in bytes per second */ private _speed; /** Expected duration to finish in seconds */ private _eta; /** * Cutoff time for the low pass filter of the ETA. * A higher value will consider more history information for calculation, * and thus suppress spikes of the speed, * but will make the overall resposiveness slower. */ private _cutoffTime; constructor(options?: EtaOptions); /** * Add more transferred bytes. * * @param done Additional bytes done. */ add(done: number): void; /** * Update the transmission state. * * @param done The new value of transferred bytes. * @param total Optionally also update the total bytes we expect. */ update(done: number, total?: number): void; reset(): void; /** * Pause the ETA calculation. */ pause(): void; /** * Resume the ETA calculation. */ resume(): void; /** * Status of the Eta (paused, active, idle). */ get status(): TEtaStatus; /** * Progress (percent done) */ get progress(): number; /** * Estimated time in seconds. * If the time is not yet estimated, it will return `Infinity`. */ get time(): number; /** * Transfer speed in bytes per second. * Returns `-1` if not yet estimated. */ get speed(): number; /** * Get the speed in human readable format using file sizes like 10KB/s. * Returns the empty string if not yet estimated. */ get speedReadable(): string; } export {};