/** * Unified progress types and utilities for archive operations. * * This module defines common progress structures used across zip and unzip operations. * Having them in a shared location reduces duplication and enables cross-module type reuse. * * @module */ /** * Common progress phase states for archive operations. */ export type ArchiveProgressPhase = "running" | "done" | "aborted" | "error"; /** * Common streaming options shared between zip and unzip. */ export interface ArchiveStreamOptions

{ /** Abort signal for cancellation */ signal?: AbortSignal; /** Progress callback */ onProgress?: (p: P) => void; /** Throttle progress callbacks; 0 emits on the next microtask */ progressIntervalMs?: number; } /** * Base operation result type. */ export interface ArchiveOperationBase

{ /** Abort signal linked to this operation */ signal: AbortSignal; /** Abort the operation */ abort(reason?: unknown): void; /** Returns bytes processed so far */ pointer(): number; /** Latest progress snapshot */ progress(): P; } export type ProgressListener = (snapshot: T) => void; export type ProgressEmitterOptions = { intervalMs?: number; }; /** * Small helper to batch frequent progress updates. * - Always sends the latest snapshot * - Throttles to at most once per `intervalMs` (default: every microtask) */ export declare class ProgressEmitter { private readonly _listener?; private readonly _intervalMs; private _lastEmitAt; private _snapshot; private _tokenSeq; private _scheduledToken; private _timeout; constructor(initial: T, listener?: ProgressListener, options?: ProgressEmitterOptions); get snapshot(): T; snapshotCopy(): T; update(patch: Partial): void; set(key: K, value: T[K]): void; mutate(mutator: (snapshot: T) => void): void; emitNow(): void; private _schedule; }