Installations
npm install xprogress
Developer Guide
Typescript
Yes
Module System
ESM
Min. Node Version
>=12
Node Version
20.2.0
NPM Version
9.6.6
Score
77.1
Supply Chain
99.1
Quality
74.4
Maintenance
100
Vulnerability
99.6
License
Releases
Unable to fetch releases
Contributors
Unable to fetch Contributors
Languages
JavaScript (100%)
Developer
miraclx
Download Statistics
Total Downloads
141,733
Last Day
628
Last Week
1,983
Last Month
8,217
Last Year
82,255
GitHub Statistics
2 Stars
164 Commits
3 Watching
1 Branches
1 Contributors
Package Meta Information
Latest Version
0.20.0
Package Id
xprogress@0.20.0
Unpacked Size
62.84 kB
Size
15.19 kB
File Count
4
NPM Version
9.6.6
Node Version
20.2.0
Publised On
20 Jun 2023
Total Downloads
Cumulative downloads
Total Downloads
141,733
Last day
0.3%
628
Compared to previous day
Last week
6.3%
1,983
Compared to previous week
Last month
0.5%
8,217
Compared to previous month
Last year
123.1%
82,255
Compared to previous year
Daily Downloads
Weekly Downloads
Monthly Downloads
Yearly Downloads
Dev Dependencies
3
xprogress
Construct Dynamic, Flexible, extensible progressive CLI bar for the terminal built with NodeJS
DOCUMENTATION INCOMPLETE
Features
- Stream management functionality
Installing
Via NPM:
1npm install xprogress
Usage
Create a basic progress bar that updates itself with 10% twice every second until it's at maximum
1import ProgressBar from 'xprogress'; 2 3const ProgressBar = require('xprogress'); 4 5const bar = new ProgressBar(100); 6 7const interval = setInterval(() => { 8 bar.tick(10).draw(); 9 if (bar.isComplete()) { 10 bar.end(`The bar completed\n`); 11 clearInterval(interval); 12 } 13}, 500);
How It Works
ProgressBar uses stringd to parse content within ProgressBar::template
with variables in ProgressBar::variables
and then displays them on the terminal.
This sequence occurs for every time ProgressBar::draw()
is called.
API
new ProgressBar
(total[, slots][, opts])
total
: <number>slots
: <HybridInput[]>opts
: <BarOpts>
Create and return an xprogress instance
slots
define the percentage to each part of the progressbar. This is parsed by pad-ratio to a max of 100.
1const bar = new ProgressBar(100, [20, 44]);
GlobOpts
: Object
bar
: Objectblank
: <string> Content to use for the blank portion of the progressbar. Default:'-'
.filler
: <string> Content to use for the filled portion of the progressbar. Default:'#'
.header
: <string> Content to use for the header(s) of progressbars. Default:''
.colorize
: <boolean> Whether or not to allow colors in the bar. Default:true
.separator
: <string> Content to use when separating bars. Default:''
.pulsateSkip
: <number> Distance away at which to skip a pulsating bar. Default:15
.pulsateLength
: <number> The length of a pulsating progressbar. Default:15
.
clean
: <boolean> Whether or not to clear the progressbar buffer on the terminal afterProgressBar::end()
has been called. Default:false
.flipper
: <string|string[]> Content(s) to use for the progressbar flipper. This would cycle through all indexes in this property for everywhere :{flipper} is speified. Default:['|', '/', '-', '\']
.pulsate
: <boolean> Whether or not to use a pulsate view for the progressbar. Default:false
.-
template
: <string|string[]> The template to use for the progressbar view. This is parsed by stringd. withthis.variables
Default:''
. -
variables
: <VariableOpts> Variables with which to parsethis.template
, extended withcStringd.raw
. forceFirst
: <boolean> Whether or not to force a multi-bar progressbar to a single bar (useful either when terminal width is too small or when filled with excess addons). Default:false
.writeStream
: <WriteStream> The tty-ish writable stream we are writing to. Default: stdout.
The global options shared by both ProgressBar and ProgressStream.
VariableOpts
extends cStringd.raw
: Object
tag
: <any> Floating mutable tag to be attached to the bar- *
bar
: <string> The progress bar itself - *
label
: <any> The label to be attached to the bar - *
total
: <any> The maximum value for the entire duration of the bar flipper
: <any> The flipper as defined in the definition for the progressbar. Default:['|', '/', '-', '\']
.- *
completed
: <any> The value for the completion level of the entire bar activity. Generated fromProgressBar::average()
.completed
- *
remaining
: <any> - *
percentage
: <any>
Variables with which to parse this.template
, extended with cStringd.raw
. variables prepended with *
will be ignored anywhere else besides wherever's explicitly requesting a drawn bar.
StreamVariables
extends VariableOpts
: Object
eta
: <string> Duration for the entire progress to end. Parsed by prettyMssize
: <ByteString> Human readable size for the number of total transferred bytes. Parsed by xbytesspeed
: <string> Human readable speed for the number of bits transferred per second. Parsed by xbytesprogress
: <ProgressStreamSlice> The Progress Objecteta:raw
: <number> Duration estimate of how long it would take for the stream to end based on the number of bytes being steadily transmitted per second.slot:bar
: <string> The bar for the active chunk of the progressbar.slot:blank
: <string> The character with which to be used as the slot's blank character.slot:eta
: <string> Duration estimate for the active chunk to be completed. Parsed by prettyMsslot:eta:raw
: <number> Duration estimate for the active chunk to be completed.slot:filler
: <string|string[]> The character(s) with which to be used as the slot's filler character.slot:header
: <string> The character with which to be used as the slot's header character.slot:size
: <ByteString> Human readable size for the number of transferred bytes specific for the active chunk. Parsed by xbytesslot:total
: <ByteString> Human readable size for the total number of bytes that can be processed by the active chunk. Parsed by xbytesslot:runtime
: <string> Runtime for the active chunk. Parsed by prettyMsslot:runtime:raw
: <number> Runtime for the active chunk.slot:percentage
: <string> Integer defining the active slot completion percentageslot:size:total
: <ByteString> Human readable size for the total number of bytes transferred in a single instance
HybridInput
: string|number|number[]
This content here is parsed by pad-ratio in the construct of an HybridInput.
Development
Building
Feel free to clone, use in adherance to the license. Pull requests are very much welcome.
1git clone https://github.com/miraclx/xprogress.git 2cd xprogress 3npm install 4# hack on code
License
Apache 2.0 © Miraculous Owonubi (@miraclx) <omiraculous@gmail.com>
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
- Warn: no pull requests merged into dev branch
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
- Warn: no security policy file detected
- Warn: no security file to analyze
- Warn: no security file to analyze
- Warn: no security file to analyze
Reason
project is not fuzzed
Details
- Warn: no fuzzer integrations found
Reason
license file not detected
Details
- Warn: project does not have a license file
Reason
branch protection not enabled on development/release branches
Details
- Warn: branch protection not enabled for branch 'master'
Score
2.6
/10
Last Scanned on 2025-01-27
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More