/** * @fileoverview Tracks byte-level progress for a media download. It is a plain * value object: the loader pushes chunks in and reads snapshots out. */ export type MediaProgressSnapshot = { /** * - The number of bytes downloaded so far. */ loaded: number; /** * - The total number of bytes (0 when unknown). */ total: number; /** * - The number of bytes left to download. */ remaining: number; /** * - The completion percentage between 0 and 100. */ percent: number; /** * - The smoothed download rate in bytes per second. */ rate: number; /** * - The elapsed time in milliseconds. */ elapsed: number; /** * - The estimated time remaining in milliseconds. */ eta: number; /** * - The number of chunks received so far. */ chunks: number; /** * - The intrinsic width of the media. */ width?: number; /** * - The intrinsic height of the media. */ height?: number; }; /** * A point-in-time snapshot of the download progress. It exposes both the raw * byte counters and the derived metrics (rate, ETA and completion percentage) * so that consumers can render progress without recalculating anything. * * @typedef {Object} MediaProgressSnapshot * @property {number} loaded - The number of bytes downloaded so far. * @property {number} total - The total number of bytes (0 when unknown). * @property {number} remaining - The number of bytes left to download. * @property {number} percent - The completion percentage between 0 and 100. * @property {number} rate - The smoothed download rate in bytes per second. * @property {number} elapsed - The elapsed time in milliseconds. * @property {number} eta - The estimated time remaining in milliseconds. * @property {number} chunks - The number of chunks received so far. * @property {number} [width] - The intrinsic width of the media. * @property {number} [height] - The intrinsic height of the media. */ /** * Accumulates download chunks and derives rate, ETA and percentage. */ declare class TinyMediaProgress { #private; /** * Initializes a new progress tracker. * @param {number} [total] - The total number of bytes (0 when unknown). * @throws {RangeError} If `total` is not a positive number. */ constructor(total?: number); /** * The total number of bytes (0 when unknown). * @returns {number} */ get total(): number; /** * Updates the total size of the media being loaded. * @param {number} value - The new total in bytes. * @throws {RangeError} If `value` is not a positive number. */ set total(value: number); /** * @returns {number} The number of bytes downloaded so far. */ get loaded(): number; /** * @returns {number} The number of bytes left to download. */ get remaining(): number; /** * @returns {number} The completion percentage between 0 and 100. */ get percent(): number; /** * @returns {number} The smoothed download rate in bytes per second. */ get rate(): number; /** * @returns {number} The number of chunks received so far. */ get chunks(): number; /** * @returns {number} The elapsed time in milliseconds. */ get elapsed(): number; /** * @returns {number} The estimated time remaining in milliseconds. */ get eta(): number; /** * Marks the start of the download. * @returns {TinyMediaProgress} The current instance for chaining. */ start(): TinyMediaProgress; /** * Registers a new chunk and updates the smoothed rate. * @param {number} bytes - The size of the chunk in bytes. * @returns {TinyMediaProgress} The current instance for chaining. * @throws {RangeError} If `bytes` is not a positive number. */ push(bytes: number): TinyMediaProgress; /** * Resets every counter so the instance can be reused. * @returns {TinyMediaProgress} The current instance for chaining. */ reset(): TinyMediaProgress; /** * Returns a read-only snapshot of the current progress and derived metrics. * @returns {MediaProgressSnapshot} An immutable snapshot of the current state. */ snapshot(): MediaProgressSnapshot; } export default TinyMediaProgress; //# sourceMappingURL=TinyMediaProgress.d.mts.map