gauge
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
aproba | 2.0.0 | 3.6 kB | ISC | prod | |
color-support | 1.1.3 | 3.56 kB | ISC | prod | |
console-control-strings | 1.1.0 | 3.26 kB | ISC | prod | |
has-unicode | 2.0.1 | 1.92 kB | ISC | prod | |
object-assign | 4.1.1 | 2.61 kB | MIT | prod | |
signal-exit | 3.0.7 | 3.76 kB | ISC | prod | |
string-width | 4.2.3 | 2.33 kB | MIT | prod | |
strip-ansi | 6.0.1 | 1.99 kB | MIT | prod | |
wide-align | 1.1.5 | 1.95 kB | ISC | prod |
Gauge is a nearly stateless terminal-based Horizontal Gauge / Progress Bar. It provides users with a dynamic interface to display status information during the execution of tasks. The gauge updates are represented visually on a single line, and it takes into account terminal resizes, responsively adapting its size accordingly.
To use Gauge in your Node.js project, first install the package by running npm install gauge
. After installation, you can start using it by requiring it in your desired file. Here's a basic usage example:
var Gauge = require("gauge")
var gauge = new Gauge()
gauge.show("working…", 0)
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.25) }, 500)
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.50) }, 1000)
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.75) }, 1500)
setTimeout(() => { gauge.pulse(); gauge.show("working…", 0.99) }, 2000)
setTimeout(() => gauge.hide(), 2300)
In the above example, Gauge()
initializes a new gauge instance. The gauge.show()
function updates the text and progress of the gauge over time, while gauge.pulse()
animates a spinner in the progress bar. Finally gauge.hide()
removes the gauge from the terminal.
The documentation for the Gauge package is available in its README file, which can be found on its GitHub page here. The documentation includes more detailed instructions for various functions and options you can utilize when creating and manipulating your Gauge. Also, additional demos and usage examples can be found in the /docs
folder of the package's GitHub repository.