How to use the cli-progress.Bar function in cli-progress

To help you get started, we’ve selected a few cli-progress examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github libin1991 / webpack4-vue-react-more-page-cli / inquirer.js命令行交互的工具 / test2.js View on Github external
//进度条
//var Gauge = require("gauge")
//var gauge = new Gauge()
//var a = 0;
//var timer = setInterval(() => {
//	a += 0.01;
//	if(a > 1) {
//		clearInterval(timer)
//	}
//	gauge.show("test", a)
//}, 30)

const _cliProgress = require('cli-progress');
const terminal = require('terminal-utilities')
const bar1 = new _cliProgress.Bar({
	//	barCompleteChar: '#',
	//  barIncompleteChar: '.',
	//  fps: 5,
	//  stream: process.stdout,
	//  barsize: 65,
	//  position: 'center'
}, _cliProgress.Presets.shades_classic);
bar1.start(200, 0);
var a = 0
var timer = setInterval(() => {
	a = a + 10
	if(a > 200) {

		bar1.stop();
		//terminal.clear()   //清屏
		clearInterval(timer);
github torch2424 / live-stream-radio / src / stream / stream.js View on Github external
if (complexFilterString.length > 0) {
      complexFilterString += `, `;
    }
    complexFilterString += `${overlayTextFilterString}`;
  }

  // Set our final output video pad
  complexFilterString += ` [videooutput]`;

  // Apply our complext filter
  ffmpegCommand = ffmpegCommand.complexFilter(complexFilterString);

  // Let's create a nice progress bar
  // Using the song length as the 100%, as that is when the stream should end
  const songTotalDuration = Math.floor(metadata.format.duration);
  const progressBar = new progress.Bar(
    {
      format: 'Audio Progress {bar} {percentage}% | Time Playing: {duration_formatted} |'
    },
    progress.Presets.shades_classic
  );

  // Set our event handlers
  ffpmepgCommand = ffmpegCommand
    .on('start', commandString => {
      console.log(' ');
      console.log(`${chalk.blue('Spawned Ffmpeg with command:')}`);
      console.log(commandString);
      console.log(' ');

      // Start our progress bar
      progressBar.start(songTotalDuration, 0);
github carlosbaraza / unicorn-contributor / src / unicorn.js View on Github external
//  | |                        / ;   \;;,\
       (<_  | ;                      /',/-----'  _>
        \_| ||_                     //~;~~~~~~~~~
            `\_|                   (,~~
                                    \~\
                                     ~~

 */

import program from "commander";
import moment from "moment-timezone";
import { spawnSync } from "child_process";
import { times, randomInt, printUnicorn, processError } from "./utils";

const _progress = require('cli-progress');
const progressBar = new _progress.Bar({}, _progress.Presets.shades_classic);

export function deliverUnicorn() {
  sanityChecks();

  console.log('Generating your human looking contribution bar...\n');
  const days = initDaysList();
  assignContributionCommands(days);

  console.log('Running GIT contributions now...\n');
  progressBar.start(program.contributions, 0);
  contribute(days);
  celebrate();
}

function sanityChecks() {
  const gitLogResults = runCommand('git log').output;
github ArkEcosystem / core / deprecated / core-snapshots-cli / src / commands / restore.ts View on Github external
public async run(): Promise {
        // tslint:disable-next-line:no-shadowed-variable
        const { flags } = this.parse(RestoreCommand);

        await setUpLite(flags);

        const emitter = app.resolvePlugin("event-emitter");

        const progressBar = new _cliProgress.Bar(
            {
                format: "{bar} {percentage}% | ETA: {eta}s | {value}/{total} | Duration: {duration}s",
            },
            _cliProgress.Presets.shades_classic,
        );

        emitter.on("start", data => {
            progressBar.start(data.count, 1);
        });

        emitter.on("progress", data => {
            progressBar.update(data.value);
        });

        emitter.on("complete", data => {
            progressBar.stop();
github AndiDittrich / NodeMCU-Tool / bin / nodemcu-tool.js View on Github external
.action(asyncWrapper(async (filelist, options) => {
        // initialize a new progress bar
        const bar = new _progressbar.Bar({
            clearOnComplete: true,
            hideCursor: true
        }, _progressbar.Presets.shades_classic);

        // expand glob expressions
        const files = await _globExpression.expand(filelist);

        // files provided ?
        if (files.length == 0){
            _logger.error('No files provided for upload (empty file-list)');
            return;
        }

        // handle multiple uploads
        let currentFileNumber = 0;
github velopert / bitimulate / bitimulate-backend / src / worker / setMonthlyValue.js View on Github external
async function processWallets() {
  try {
    const rates = await getAllExchangeRate();
    const count = await getUsersCount();

    const usdRate = getPrice(rates, 'USD');
    log.info(count, 'users');
    const length = Math.ceil(count / batchSize);

    const bar = new progress.Bar({}, progress.Presets.shades_classic);
    bar.start(length - 1, 0);
    for(let i = 0; i < length; i++) {
      const users = await User.find().skip(i * batchSize).limit(batchSize).exec();
      const promises = users.map(user => {
        const combined = combineWallet(user.wallet, user.walletOnOrder);
        const btc = convertToBTC(combined, rates);
        const currentUSD = btc / usdRate;
        console.log(currentUSD);
        return user.saveMonthlyUSD(currentUSD, usdRate);
      });
      await Promise.all(promises);
      bar.update(i);
    }
    bar.stop();
  } catch (e) {
    console.log(e);
github anasrar / Samehadaku-Lewatin / module / dl.js View on Github external
await req.on('response', res => {
        if (!res.headers['content-disposition']) {
            console.log('🔁  ' + _colors.blue('Server Download Error, Try To Get New Link...'))
            exports.ZippyDL(u, cb)
        } else {
            console.log('✅  ' + _colors.green('Server Response'))
            const size = parseInt(res.headers['content-length'], 10),
                filename = decodeURIComponent(res.headers['content-disposition'].match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?/)[1])
            let currentSize = 0
            console.log('☕  ' + _colors.yellow('Start Downloading File : ' + filename))
            const file = _fs.createWriteStream(filename)
            res.pipe(file)
            const loadbar = new _proggers.Bar({
                format: 'Downloading ' + _colors.green('{bar}') + ' {percentage}% | {current}/{size} | ETA: {eta}s | Speed: {speed}',
                barsize: 25
            }, _proggers.Presets.shades_classic)
            loadbar.start(size, 0, {
                size: clacSize(size, 3),
                current: clacSize(currentSize, 3),
                speed: 0
            })
            res.on('data', c => {
                currentSize += c.length;
                loadbar.increment(c.length, {
                    speed: clacSize(c.length),
                    current: clacSize(currentSize, 3)
                })
            })
            res.on('end', _ => {
github ArkEcosystem / core / packages / core / src / commands / snapshot / restore.ts View on Github external
if (!app.has("snapshots")) {
            this.error("The @arkecosystem/core-snapshots plugin is not installed.");
        }

        if (!flags.blocks) {
            try {
                await chooseSnapshot(flags, "What snapshot do you want to restore?");
            } catch (error) {
                this.error(error.message);
            }
        }

        const emitter = app.resolvePlugin("event-emitter");

        const progressBar = new cliProgress.Bar(
            {
                format: "{bar} {percentage}% | ETA: {eta}s | {value}/{total} | Duration: {duration}s",
            },
            cliProgress.Presets.shades_classic,
        );

        emitter.on("start", data => {
            progressBar.start(data.count, 1);
        });

        emitter.on("progress", data => {
            progressBar.update(data.value);
        });

        emitter.on("complete", data => {
            progressBar.stop();

cli-progress

easy to use progress-bar for command-line/terminal applications

MIT
Latest version published 1 year ago

Package Health Score

70 / 100
Full package analysis