vlocode-project - v2.4.3
    Preparing search index...

    Class ProgressBar

    An animated, multi-line progress bar that sticks to the bottom of a terminal: a gauge line (with spinner, percentage, count, throughput and ETA/elapsed) plus any number of caller-supplied summary lines. The whole block is redrawn in place on each tick, so the summary lines act as a live, compact dashboard rather than scrolling output.

    The bar is a pure renderer over a ProgressTracker — it carries no global state, so multiple independent bars can exist (though only one should own a given stream at a time). It uses raw ANSI escapes and has no third-party dependencies; colour is auto-detected from the stream and honours NO_COLOR/FORCE_COLOR.

    const bar = new ProgressBar({ label: 'Building', total: files.length });
    bar.start();
    for (const [i, file] of files.entries()) {
    await build(file);
    bar.update({ value: i + 1, message: file });
    }
    bar.stop('✔ Build complete');
    Index

    Constructors

    Properties

    active: boolean = false
    barOnScreen: boolean = false
    barWidth: number
    details: string[] | (() => string[]) = []
    paint: AnsiPainter
    refreshIntervalMs: number
    renderedLines: number = 0
    spinnerFrame: number = 0
    stream: WriteStream
    timer?: Timeout

    Accessors

    • get isInteractive(): boolean

      Whether the target stream is a TTY, i.e. whether an animated bar makes sense at all. Callers typically also consider CI/verbose-logging conditions before choosing to render one.

      Returns boolean

    Methods

    • Escape sequence that returns the cursor from the end of the last rendered line back to column 0 of the block's first line, ready for a clear-and-redraw.

      Returns string

    • Print a line above the live block, then redraw the block beneath it. When the bar is not active the line is written as-is.

      Parameters

      • line: string

      Returns void

    • Restore the cursor on abrupt process exit (e.g. Ctrl-C) so the terminal is not left without a cursor when the bar never got a chance to stop cleanly.

      Returns void

    • Stop animating, erase the block and restore the terminal. Optionally prints a final line where the block was.

      Parameters

      • OptionalfinalLine: string

      Returns void