1 | /*!
|
2 | * node-progress
|
3 | * Copyright(c) 2011 TJ Holowaychuk <tj@vision-media.ca>
|
4 | * MIT Licensed
|
5 | */
|
6 | export declare abstract class ProgressBar {
|
7 | private readonly format;
|
8 | private readonly stream;
|
9 | private current;
|
10 | total: number;
|
11 | private readonly width;
|
12 | private chars;
|
13 | private tokens;
|
14 | private lastDraw;
|
15 | private start;
|
16 | private complete;
|
17 | /**
|
18 | * Initialize a `ProgressBar` with the given `fmt` string and `options` or`total`.
|
19 | *
|
20 | * Options:
|
21 | * - `curr` current completed index
|
22 | * - `total` total number of ticks to complete
|
23 | * - `width` the displayed width of the progress bar defaulting to total
|
24 | * - `stream` the output stream defaulting to stderr
|
25 | * - `head` head character defaulting to complete character
|
26 | * - `complete` completion character defaulting to "="
|
27 | * - `incomplete` incomplete character defaulting to "-"
|
28 | * - `renderThrottle` minimum time between updates in milliseconds defaulting to 16
|
29 | * - `callback` optional function to call when the progress bar completes
|
30 | * - `clear` will clear the progress bar upon termination
|
31 | *
|
32 | * Tokens:
|
33 | * - `:bar` the progress bar itself
|
34 | * - `:current` current tick number
|
35 | * - `:total` total ticks
|
36 | * - `:elapsed` time elapsed in seconds
|
37 | * - `:percent` completion percentage
|
38 | * - `:eta` eta in seconds
|
39 | * - `:rate` rate of ticks per second
|
40 | */
|
41 | constructor(format: string, options?: any);
|
42 | /**
|
43 | * "tick" the progress bar with optional `len` and optional `tokens`.
|
44 | */
|
45 | tick(delta: number): void;
|
46 | set currentAmount(value: number);
|
47 | render(): void;
|
48 | /**
|
49 | * "update" the progress bar to represent an exact percentage.
|
50 | * The ratio (between 0 and 1) specified will be multiplied by `total` and
|
51 | * floored, representing the closest available "tick." For example, if a
|
52 | * progress bar has a length of 3 and `update(0.5)` is called, the progress
|
53 | * will be set to 1.
|
54 | *
|
55 | * A ratio of 0.5 will attempt to set the progress to halfway.
|
56 | */
|
57 | update(ratio: number): void;
|
58 | /**
|
59 | * "interrupt" the progress bar and write a message above it.
|
60 | */
|
61 | interrupt(message: string): void;
|
62 | abstract terminate(): void;
|
63 | }
|
64 | export declare class ProgressCallback {
|
65 | private readonly progressBar;
|
66 | private start;
|
67 | private nextUpdate;
|
68 | constructor(progressBar: ProgressBar);
|
69 | update(transferred: number, total: number): void;
|
70 | }
|