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
1.0.5
Version published
Weekly downloads
2.4K
16.67%
Maintainers
1
Weekly downloads
 
Created
Source

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

Node.js CLI progress bar.

Simple demo dark Simple demo light

Install

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

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

Usage

const ProgressBar = require('@open-tech-world/cli-progress-bar');

// or

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

const progressBar = new ProgressBar();
progressBar.run('Downloading', 0, 100);
progressBar.run('Download completed', 100, 100);
progressBar.stop();

Examples

See more examples here

Clone the repo and run it

$ node examples/simple.js

API

constructor(options = {})

The initializing method of a ProgressBar class.

new ProgressBar();

new ProgressBar({});

new ProgressBar({ width: 40 });

options: object, default {}

  • width: number, default 30
  • stream: stream, default process.stderr
  • barChar: string, default '\u2588'

run(action = '', curVal = 0, totalVal = 0, statusText = '')

Starts or updates the current progress bar instance.

progressBar.run('Running tasks', 23, 150)

progressBar.run('Downloaded', 72, 72)

progressBar.run('Downloading', 3, 10, `ETA: ${speed}`)
  • action: string, default '' - used to display progress bar actions on the left side of progress bar
  • curVal: number, default 0 - current value of a progress bar
  • totalVal: number, default 0 - total value of a progress bar
  • statusText: string, default '' - used to show some additional info on the right side of a progress bar

stop(clear = false)

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

progressBar.stop()

progressBar.stop(true)
  • clear: boolean, default false - used to clear or remove the progress bar after stops

License

MIT © Thanga Ganapathy

Keywords

node

FAQs

Package last updated on 18 Jun 2019

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