Abstract Class: ProgressBar
Constructors
Constructor
new ProgressBar(
format,options?):ProgressBar
Initialize a ProgressBar with the given fmt string and options ortotal.
Options:
currcurrent completed indextotaltotal number of ticks to completewidththe displayed width of the progress bar defaulting to totalstreamthe output stream defaulting to stderrheadhead character defaulting to complete charactercompletecompletion character defaulting to "="incompleteincomplete character defaulting to "-"renderThrottleminimum time between updates in milliseconds defaulting to 16callbackoptional function to call when the progress bar completesclearwill clear the progress bar upon termination
Tokens:
:barthe progress bar itself:currentcurrent tick number:totaltotal ticks:elapsedtime elapsed in seconds:percentcompletion percentage:etaeta in seconds:raterate of ticks per second
Parameters
format
string
options?
any = {}
Returns
ProgressBar
Properties
total
total:
number=0
Accessors
currentAmount
Set Signature
set currentAmount(
value):void
Parameters
value
number
Returns
void
Methods
interrupt()
interrupt(
message):void
"interrupt" the progress bar and write a message above it.
Parameters
message
string
Returns
void
render()
render():
void
Returns
void
terminate()
abstractterminate():void
Returns
void
tick()
tick(
delta):void
"tick" the progress bar with optional len and optional tokens.
Parameters
delta
number
Returns
void
update()
update(
ratio):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.
Parameters
ratio
number
Returns
void