@types/progress
- Version 2.0.7
- Published
- 6.51 kB
- 1 dependency
- MIT license
Install
npm i @types/progress
yarn add @types/progress
pnpm add @types/progress
Overview
TypeScript definitions for progress
Index
Classes
class ProgressBar
class ProgressBar {}
Flexible ascii progress bar.
constructor
constructor(format: string, total: number);
Initialize a
ProgressBar
with the givenfmt
string andoptions
ortotal
.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 terminationTokens: -
: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
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'sfmt
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 optionaltokens
.
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 andupdate(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.
Interfaces
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.
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/progress
.
- Markdown[![jsDocs.io](https://img.shields.io/badge/jsDocs.io-reference-blue)](https://www.jsdocs.io/package/@types/progress)
- 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>
- Updated .
Package analyzed in 3396 ms. - Missing or incorrect documentation? Open an issue for this package.