@types/progress
- Version 2.0.7
- Published
- 6.51 kB
- 1 dependency
- MIT license
Install
npm i @types/progressyarn add @types/progresspnpm add @types/progressOverview
TypeScript definitions for progress
Index
Classes
class ProgressBar
class ProgressBar {}Flexible ascii progress bar.
constructor
constructor(format: string, total: number);Initialize a
ProgressBarwith the givenfmtstring andoptionsortotal.Options: -
totaltotal number of ticks to complete -widththe displayed width of the progress bar defaulting to total -streamthe output stream defaulting to stderr -completecompletion character defaulting to "=" -incompleteincomplete character defaulting to "-" -renderThrottleminimum time between updates in milliseconds defaulting to 16 -callbackoptional function to call when the progress bar completes -clearwill clear the progress bar upon terminationTokens: -
:barthe progress bar itself -:currentcurrent tick number -:totaltotal ticks -:elapsedtime elapsed in seconds -:percentcompletion percentage -:etaeta 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
tokensto place in the progress bar'sfmtfield.
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
lenand 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
totaland 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[](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.
