@types/cli-progress
- Version 3.11.6
- Published
- 13.1 kB
- 1 dependency
- MIT license
Install
npm i @types/cli-progressyarn add @types/cli-progresspnpm add @types/cli-progressOverview
TypeScript definitions for cli-progress
Index
Variables
Classes
Interfaces
Options
- align
- autopadding
- autopaddingChar
- barCompleteChar
- barCompleteString
- barGlue
- barIncompleteChar
- barIncompleteString
- barsize
- clearOnComplete
- emptyOnZero
- etaAsynchronousUpdate
- etaBuffer
- forceRedraw
- format
- formatBar
- formatTime
- formatValue
- fps
- gracefulExit
- hideCursor
- linewrap
- notTTYSchedule
- noTTYOutput
- progressCalculationRelative
- stopOnComplete
- stream
- synchronousUpdate
Type Aliases
Variables
variable defaultFormatter
const defaultFormatter: GenericFormatter;variable Format
const Format: { Formatter: typeof defaultFormatter; BarFormat: typeof formatBar; ValueFormat: typeof formatValue; TimeFormat: typeof formatTime;};variable formatBar
const formatBar: BarFormatter;variable formatTime
const formatTime: TimeFormatter;variable formatValue
const formatValue: ValueFormatter;variable Presets
const Presets: { legacy: Preset; rect: Preset; shades_classic: Preset; shades_grey: Preset;};Classes
class Bar
class Bar extends SingleBar {}class GenericBar
class GenericBar extends EventEmitter {}constructor
constructor(opt: Options, preset?: Preset);Initialize a new Progress bar. An instance can be used multiple times! it's not required to re-create it!
property isActive
isActive: boolean;Whether the progress bar is active
method getProgress
getProgress: () => number;Calculate the actual progress value
method getTotal
getTotal: () => number;Get the total (limit) value
method increment
increment: { (step?: number, payload?: object): void; (payload: object): void };Increases the current progress value by a specified amount (default +1). Update payload optionally
method render
render: (forceRendering?: boolean) => void;Internal render function
method setTotal
setTotal: (total: number) => void;Sets the total progress value while progressbar is active. Especially useful handling dynamic tasks.
method start
start: (total: number, startValue: number, payload?: object) => void;Starts the progress bar and set the total and initial value
method stop
stop: () => void;Stops the progress bar and go to next line
method update
update: { (current: number, payload?: object): void; (payload: object): void };Sets the current progress value and optionally the payload with values of custom tokens as a second parameter
method updateETA
updateETA: () => void;Force eta calculation update (long running processes) without altering the progress values.
class MultiBar
class MultiBar extends EventEmitter {}constructor
constructor(opt: Options, preset?: Preset);property isActive
isActive: boolean;Whether the progress bar is active
method create
create: ( total: number, startValue: number, payload?: any, barOptions?: Options) => SingleBar;Add a new bar to the stack
method log
log: (data: string) => void;Log output above the progress bars; string must end with newline character!
method remove
remove: (bar: SingleBar) => boolean;Remove a bar from the stack
method stop
stop: () => void;method update
update: () => void;Internal update routine
class SingleBar
class SingleBar extends GenericBar {}constructor
constructor(opt: Options, preset?: Preset);Initialize a new Progress bar. An instance can be used multiple times! it's not required to re-create it!
method render
render: () => void;Internal render function
method start
start: (total: number, startValue: number, payload?: object) => void;Starts the progress bar and set the total and initial value
method stop
stop: () => void;Stops the progress bar and go to next line
method update
update: { (current: number, payload?: object): void; (payload: object): void };Sets the current progress value and optionally the payload with values of custom tokens as a second parameter
Interfaces
interface BarFormatter
interface BarFormatter {}call signature
(progress: number, options: Options): string;interface GenericFormatter
interface GenericFormatter {}call signature
(options: Options, params: Params, payload: any): string;interface Options
interface Options {}property align
align?: 'left' | 'right' | 'center' | undefined;Position of the progress bar - 'left' (default), 'right' or 'center
property autopadding
autopadding?: boolean | undefined;Add padding chars to formatted time and percentage to force fixed width (default: false)
property autopaddingChar
autopaddingChar?: string | undefined;The character sequence used for autopadding (default: " ")
property barCompleteChar
barCompleteChar?: string | undefined;Character to use as "complete" indicator in the bar (default: "=")
property barCompleteString
barCompleteString?: string | undefined;Character to use as "complete" indicator in the bar (default: "=")
property barGlue
barGlue?: string | undefined;Glue sequence (control chars) between bar elements (default: '')
property barIncompleteChar
barIncompleteChar?: string | undefined;Character to use as "incomplete" indicator in the bar (default: "-")
property barIncompleteString
barIncompleteString?: string | undefined;Character to use as "incomplete" indicator in the bar (default: "-")
property barsize
barsize?: number | undefined;The length of the progress bar in chars (default: 40)
property clearOnComplete
clearOnComplete?: boolean | undefined;Clear the progress bar on complete / stop() call (default: false)
property emptyOnZero
emptyOnZero?: boolean | undefined;Display progress bars with 'total' of zero(0) as empty, not full (default: false)
property etaAsynchronousUpdate
etaAsynchronousUpdate?: boolean | undefined;Trigger an eta calculation update during asynchronous rendering trigger using the current value - should only be used for long running processes in conjunction with lof
fpsvalues and largeetaBufferfalse
property etaBuffer
etaBuffer?: number | undefined;Number of updates with which to calculate the eta; higher numbers give a more stable eta (default: 10)
property forceRedraw
forceRedraw?: boolean | undefined;Trigger redraw on every frame even if progress remains the same; can be useful if progress bar gets overwritten by other concurrent writes to the terminal (default: false)
property format
format?: string | GenericFormatter | undefined;Progress bar output format. The progressbar can be customized by using the following build-in placeholders. They can be combined in any order. {bar} - the progress bar, customizable by the options barsize, barCompleteString and barIncompleteString {percentage} - the current progress in percent (0-100) {total} - the end value {value} - the current value set by last update() call {eta} - expected time of accomplishment in seconds {duration} - elapsed time in seconds {eta_formatted} - expected time of accomplishment formatted into appropriate units {duration_formatted} - elapsed time formatted into appropriate units
Example: progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total} is rendered as progress [========================================] 100% | ETA: 0s | 200/200
property formatBar
formatBar?: BarFormatter | undefined;A custom bar formatter function which renders the bar-element (default: format-bar.js)
property formatTime
formatTime?: TimeFormatter | undefined;A custom timer formatter function which renders the formatted time elements like eta_formatted and duration-formatted (default: format-time.js)
property formatValue
formatValue?: ValueFormatter | undefined;A custom value formatter function which renders all other values (default: format-value.js)
property fps
fps?: number | undefined;The maximum update rate (default: 10)
property gracefulExit
gracefulExit?: boolean | undefined;Stop bar on SIGINT/SIGTERM to restore cursor settings (default: true)
property hideCursor
hideCursor?: boolean | null | undefined;Hide the cursor during progress operation; restored on complete (default: false) - pass
nullto keep terminal settings
property linewrap
linewrap?: boolean | null | undefined;Disable line wrapping (default: false) - pass null to keep terminal settings; pass true to trim the output to terminal width
property notTTYSchedule
notTTYSchedule?: number | undefined;Set the output schedule/interval for notty output in ms (default: 2000ms)
property noTTYOutput
noTTYOutput?: boolean | undefined;Enable scheduled output to notty streams - e.g. redirect to files (default: false)
property progressCalculationRelative
progressCalculationRelative?: boolean | undefined;Progress calculation relative to start value ? default start at 0 (default: false)
property stopOnComplete
stopOnComplete?: boolean | undefined;Automatically call stop() when the value reaches the total (default: false)
property stream
stream?: NodeJS.WritableStream | undefined;Output stream to use (default: process.stderr)
property synchronousUpdate
synchronousUpdate?: boolean | undefined;Trigger redraw during update() in case threshold time x2 is exceeded (default: true) - limited to single bar usage
interface Params
interface Params {}interface Preset
interface Preset {}property barCompleteChar
barCompleteChar: string;property barIncompleteChar
barIncompleteChar: string;property format
format: string;Example: 'progress [{bar}] {percentage}% | ETA: {eta}s | {value}/{total}'
{bar} - the progress bar, customizable by the options barsize, barCompleteString and barIncompleteString
{percentage} - the current progress in percent (0-100)
{total} - the end value
{value} - the current value set by last update() call
{eta} - expected time of accomplishment in seconds (limited to 115days, otherwise INF is displayed)
{duration} - elapsed time in seconds
{eta_formatted} - expected time of accomplishment formatted into appropriate units
{duration_formatted} - elapsed time formatted into appropriate units
interface TimeFormatter
interface TimeFormatter {}call signature
(t: number, options: Options, roundToMultipleOf: number): string;interface ValueFormatter
interface ValueFormatter {}call signature
(v: number, options: Options, type: ValueType): string;Type Aliases
type ValueType
type ValueType = 'percentage' | 'total' | 'value' | 'eta' | 'duration';Package Files (1)
Dependencies (1)
Dev Dependencies (0)
No dev dependencies.
Peer Dependencies (0)
No peer dependencies.
Badge
To add a badge like this oneto 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/cli-progress.
- Markdown[](https://www.jsdocs.io/package/@types/cli-progress)
- HTML<a href="https://www.jsdocs.io/package/@types/cli-progress"><img src="https://img.shields.io/badge/jsDocs.io-reference-blue" alt="jsDocs.io"></a>
- Updated .
Package analyzed in 3904 ms. - Missing or incorrect documentation? Open an issue for this package.
