/** * Progress bar options interface */ export interface ProgressBarOptions { /** Current completed index */ curr?: number; /** Total number of ticks to complete */ total: number; /** The displayed width of the progress bar defaulting to total */ width?: number; /** The output stream defaulting to stderr */ stream?: NodeJS.WriteStream; /** Head character defaulting to complete character */ head?: string; /** Completion character defaulting to "=" */ complete?: string; /** Incomplete character defaulting to "-" */ incomplete?: string; /** Minimum time between updates in milliseconds defaulting to 16 */ renderThrottle?: number; /** Optional function to call when the progress bar completes */ callback?: (progressBar: ProgressBar) => void; /** Will clear the progress bar upon termination */ clear?: boolean; /** Optional boolean to force stderr to be TTY */ forceTTY?: boolean; } /** * Token object for progress bar template replacement */ export interface ProgressBarTokens { [key: string]: string | number; } /** * Character configuration for progress bar display */ interface ProgressBarChars { complete: string; incomplete: string; head: string; } /** * ProgressBar class for displaying progress in terminal * * Tokens: * - `:bar` the progress bar itself * - `:current` current tick number * - `:total` total ticks * - `:elapsed` time elapsed in seconds * - `:percent` completion percentage * - `:eta` eta in seconds * - `:rate` rate of ticks per second */ export declare class ProgressBar { fmt: string; curr: number; total: number; width: number; clear: boolean; chars: ProgressBarChars; renderThrottle: number; lastRender: number; callback: (progressBar: ProgressBar) => void; tokens: ProgressBarTokens; lastDraw: string; stream: NodeJS.WriteStream; start?: Date; complete?: boolean; /** * Initialize a ProgressBar with the given format string and options * @param fmt Format string for the progress bar * @param options Configuration options or total number */ constructor(fmt: string, options: ProgressBarOptions | number); /** * "tick" the progress bar with optional `len` and optional `tokens`. * @param len Length to increment or tokens object * @param tokens Optional tokens for template replacement */ tick(len?: number | ProgressBarTokens, tokens?: ProgressBarTokens): void; /** * Method to render the progress bar with optional `tokens` to place in the * progress bar's `fmt` field. * @param tokens Optional tokens for template replacement * @param force Force rendering even if throttled */ render(tokens?: ProgressBarTokens, force?: boolean): void; /** * "update" the progress bar to represent an exact percentage. * The ratio (between 0 and 1) specified will be multiplied by `total` and * floored, representing the closest available "tick." For example, if a * progress bar has a length of 3 and `update(0.5)` is called, the progress * will be set to 1. * * A ratio of 0.5 will attempt to set the progress to halfway. * @param ratio The ratio (between 0 and 1 inclusive) to set the overall completion to * @param tokens Optional tokens for template replacement */ update(ratio: number, tokens?: ProgressBarTokens): void; /** * "interrupt" the progress bar and write a message above it. * @param message The message to write */ interrupt(message: string): void; /** * Terminates a progress bar. */ terminate(): void; /** * Begin a interrupt so the user can manually write messages above the bar. */ interruptBegin(): void; /** * End a interrupt, rendering the last draw again. */ interruptEnd(): void; } export {}; //# sourceMappingURL=node-progress.d.ts.map