Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

@open-tech-world/cli-progress-bar

Package Overview
Dependencies
Maintainers
1
Versions
10
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@open-tech-world/cli-progress-bar

Node.js CLI progress bar.

Source
npmnpm
Version
2.0.0
Version published
Weekly downloads
3K
26.52%
Maintainers
1
Weekly downloads
 
Created
Source

@open-tech-world/cli-progress-bar

Node.js CLI progress bar.

Installation

Using npm

$ npm install @open-tech-world/cli-progress-bar

Using Yarn

$ yarn add @open-tech-world/cli-progress-bar

Usage

import { ProgressBar } from '@open-tech-world/cli-progress-bar';

const pBar = new ProgressBar();
pBar.run({value: 0, total: 100, prefix: 'Downloading'});
pBar.run({value: 50, total: 100, prefix: 'Downloading'});
pBar.run({value: 100, total: 100, prefix: 'Download Completed!'});

API

new ProgressBar(Partial<IOptions>)

It creates a new instance of the ProgressBar.

options:

NameTypeDefaultDescription
streamNodeJS.WriteStreamprocess.stderrThe stream to use.
widthnumber30The size of the progress bar.
prefixstring''The string to be prefixed progress bar.
suffixstring''The string to be suffixed progress bar.
colorstring'green'The color to render the progress bar. See the supported color names here.
autoClearbooleanfalseIf true, then it auto clears the progress bar when it reaches 100%.

Instance methods:

run(options): void

Runs the current progress bar instance with the given values & options.

options:

NameTypeDefaultDescription
valuenumberNaNThe current value of the progress bar.
totalnumberNaNThe total value for the progress bar.
prefixstring''The string to be prefixed progress bar.
suffixstring''The string to be suffixed progress bar.
colorstring'green'The color to render the progress bar. See the supported color names here.

stop(clear = false): void

Stops the current progress bar instance with the current state and optionally clears the progress bar.

pBar.stop(); // It just stops the progress bar.

pBar.stop(true); // It stops & removes the progress bar.

License

Copyright (c) 2021, Thanga Ganapathy (MIT License).

Keywords

node

FAQs

Package last updated on 16 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts