• Version 2.0.7
  • Published
  • 6.51 kB
  • 1 dependency
  • MIT license


npm i @types/progress
yarn add @types/progress
pnpm add @types/progress


TypeScript definitions for progress



class ProgressBar

class ProgressBar {}
  • Flexible ascii progress bar.


constructor(format: string, total: number);
  • Initialize a ProgressBar with the given fmt string and options or total.

    Options: - total total number of ticks to complete - width the displayed width of the progress bar defaulting to total - stream the output stream defaulting to stderr - complete completion character defaulting to "=" - incomplete incomplete character defaulting to "-" - renderThrottle minimum time between updates in milliseconds defaulting to 16 - callback optional function to call when the progress bar completes - clear will clear the progress bar upon termination

    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


constructor(format: string, options: ProgressBar.ProgressBarOptions);

    property complete

    complete: boolean;
    • Completed status of progress (Boolean)

    property curr

    curr: number;
    • Current tick number.

    property total

    total: number;
    • Total number of ticks to complete.

    method interrupt

    interrupt: (message: string) => void;
    • "interrupt" the progress bar and write a message above it.

    method render

    render: (tokens?: any, force?: boolean) => void;
    • Method to render the progress bar with optional tokens to place in the progress bar's fmt field.

    method terminate

    terminate: () => void;
    • Terminates a progress bar.

    method tick

    tick: { (tokens?: any): void; (count?: number, tokens?: any): void };
    • "tick" the progress bar with optional len and optional tokens.

    method update

    update: (ratio: number, tokens?: any) => 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.

      Parameter ratio

      The ratio (between 0 and 1 inclusive) to set the overall completion to.


    interface ProgressBarOptions

    interface ProgressBarOptions {}
    • These are keys in the options object you can pass to the progress bar along with total as seen in the example above.

    property callback

    callback?: Function | undefined;
    • Optional function to call when the progress bar completes.

    property clear

    clear?: boolean | undefined;
    • Option to clear the bar on completion defaulting to false.

    property complete

    complete?: string | undefined;
    • Completion character defaulting to "=".

    property curr

    curr?: number | undefined;
    • current completed index

    property head

    head?: string | undefined;
    • head character defaulting to complete character

    property incomplete

    incomplete?: string | undefined;
    • Incomplete character defaulting to "-".

    property renderThrottle

    renderThrottle?: number | undefined;
    • minimum time between updates in milliseconds defaulting to 16

    property stream

    stream?: NodeJS.WritableStream | undefined;
    • The output stream defaulting to stderr.

    property total

    total: number;
    • Total number of ticks to complete.

    property width

    width?: number | undefined;
    • The displayed width of the progress bar defaulting to total.

    Package Files (1)

    Dependencies (1)

    Dev Dependencies (0)

    No dev dependencies.

    Peer Dependencies (0)

    No peer dependencies.


    To add a badge like this onejsDocs.io badgeto your package's README, use the codes available below.

    You may also use Shields.io to create a custom badge linking to https://www.jsdocs.io/package/@types/progress.

    • Markdown
    • HTML
      <a href="https://www.jsdocs.io/package/@types/progress"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>