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

xprogress

v0.20.0

Published

Dynamic, Flexible, extensible progressive CLI bar for the terminal built with NodeJS

Downloads

7,079

Readme

xprogress

Construct Dynamic, Flexible, extensible progressive CLI bar for the terminal built with NodeJS

DOCUMENTATION INCOMPLETE

Features

  • Stream management functionality

NPM Version NPM Downloads

NPM

Installing

Via NPM:

npm install xprogress

Usage

Create a basic progress bar that updates itself with 10% twice every second until it's at maximum

import ProgressBar from 'xprogress';

const ProgressBar = require('xprogress');

const bar = new ProgressBar(100);

const interval = setInterval(() => {
  bar.tick(10).draw();
  if (bar.isComplete()) {
    bar.end(`The bar completed\n`);
    clearInterval(interval);
  }
}, 500);

XProgress Example Result

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])

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.

const bar = new ProgressBar(100, [20, 44]);

GlobOpts: Object

  • bar: Object
    • blank: <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 after ProgressBar::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. with this.variables Default: ''.
  • variables: <VariableOpts> Variables with which to parse this.template, extended with cStringd.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 from ProgressBar::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 prettyMs
  • size: <ByteString> Human readable size for the number of total transferred bytes. Parsed by xbytes
  • speed: <string> Human readable speed for the number of bits transferred per second. Parsed by xbytes
  • progress: <ProgressStreamSlice> The Progress Object
  • eta: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 prettyMs
  • slot: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 xbytes
  • slot:total: <ByteString> Human readable size for the total number of bytes that can be processed by the active chunk. Parsed by xbytes
  • slot:runtime: <string> Runtime for the active chunk. Parsed by prettyMs
  • slot:runtime:raw: <number> Runtime for the active chunk.
  • slot:percentage: <string> Integer defining the active slot completion percentage
  • slot: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.

git clone https://github.com/miraclx/xprogress.git
cd xprogress
npm install
# hack on code

License

Apache 2.0 © Miraculous Owonubi (@miraclx) <[email protected]>