npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@khaidev1012/cli-pbar

v0.0.1

Published

CLI progress bar.

Downloads

6

Readme

@opentf/cli-pbar

⚡ by OPEN TECH FOUNDATION

Build

CLI progress bar.

Features

  • Single & Multi progress bar

  • Custom bar colors

  • Multiple sizes

Installation

npm install cli-pbar
yarn add cli-pbar
pnpm add cli-pbar

Syntax

new ProgressBar(options?: Options)

Usage

Single progress bar.

import { ProgressBar } from 'cli-pbar';

const pBar = new ProgressBar();
pBar.start({ total: 100 });
pBar.update({ value: 50 });
pBar.update({ value: 100 });
pBar.stop();

Multi progress bar.

import { ProgressBar } from 'cli-pbar';

const multiPBar = new ProgressBar();
multiPBar.start();
const b1 = multiPBar.add({ total: 100 });
const b2 = multiPBar.add({ total: 100 });
const b3 = multiPBar.add({ total: 100 });
b1.update({ value: 23 });
b3.update({ value: 35 });
b2.update({ value: 17 });
multiPBar.stop();

API

options:

| Name | Type | Default | Description | | --------- | ------------------ | -------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | stream | NodeJS.WriteStream | process.stderr | The stream to use. | | width | number | 30 | The size of the progress bar. | | prefix | string | '' | The string to be prefixed progress bar. | | suffix | string | '' | The string to be suffixed progress bar. | | color | string | 'g' | The color to render the completed progress bar.The default color is green. It uses @opentf/cli-styles for colors.You can also use the rgb & hex color modes, please refer the supported color keys here. | | bgColor | string | 'gr' | The color to render the incomplete progress bar.The default color is grey. It uses @opentf/cli-styles for colors.You can also use the rgb & hex color modes, please refer the supported color keys here. | | size | string | 'DEFAULT' | The size of the progress bar to render.Available sizes:'DEFAULT''MEDIUM''SMALL' | | autoClear | boolean | false | If true, then it auto-clears the progress bar after the stop method is called. |

Instance methods:

start(obj?: Partial<Bar>): void

After the method is called, the progress bar starts rendering.

Bar:

| Name | Type | Default | Description | | -------- | ------- | --------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | total | number | NaN | The total value for the progress bar. | | value | number | NaN | The current value of the progress bar. | | prefix | string | '' | The string to be prefixed progress bar. | | suffix | string | '' | The string to be suffixed progress bar. | | color | string | 'g' | The color to render the completed progress bar.The default color is green. It uses @opentf/cli-styles for colors.You can also use the rgb & hex color modes, please refer the supported color keys here. | | bgColor | string | 'gr' | The color to render the incomplete progress bar.The default color is grey. It uses @opentf/cli-styles for colors.You can also use the rgb & hex color modes, please refer the supported color keys here. | | size | string | 'DEFAULT' | The size of the progress bar.Available sizes:'DEFAULT''MEDIUM''SMALL' | | progress | boolean | true | If false, it does not render a progress bar, making it useful to add an empty line or text without displaying a progress bar. |

add(obj: Partial<Bar>): { update: (obj: Partial<Bar>) => void }

In multi-progress bars, it appends a progress bar to the container and returns an object with a method to update it.

update(obj: Partial<Bar>): void

In updates the current progress bar instance.

stop(msg?: string): void

Stops the current progress bar instance with the current state and optionally clears the progress bar when autoClear is true.

You can also pass msg text to be displayed after the instance stops.

Related

License

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