How to use the cli-progress.Presets 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 torch2424 / live-stream-radio / src / stream / stream.js View on Github external
}

  // 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);
    })
    .on('end', () => {
      progressBar.stop();
      if (endCallback) {
github apolloeleven / qa-screenshot-comparator / capture.js View on Github external
const captureScreenshots = async () => {

    // create a new progress bar instance and use shades_classic theme
    const bar1 = new _cliProgress.Bar({}, _cliProgress.Presets.shades_classic);

    let urls = await sitemapParser.getUrls(__dirname + '/sitemap.xml');
    const devicesToEmulate = [
        'iPhone 6',
        'iPhone 6 landscape',
        'iPhone 6 Plus',
        'Nexus 6',
        'iPad Pro'
    ];

    // urls = [
    //     'http://career.de.car1411dev.intermundia.de/',
    //     'http://career.de.car1411dev.intermundia.de/de/stellenangebote/leiter-projektmanagement-produktmanagement-m-w',
    //     'http://career.de.car1411dev.intermundia.de/de/was-wir-machen'
    // ];
    // urls = urls.slice(0, 10);
github codeformunich / radlquartier / datatool / share / DataParserJson.js View on Github external
constructor(outputFolder, tempFileName, dataFileName, provider) {
    this.outputFolder = outputFolder;
    this.tempFileName = tempFileName;
    this.dataFileName = dataFileName;
    this.provider = provider;

    // create a new progress bar instances
    this.processDirectoryBar = new cliProgress.Bar(
      {},
      cliProgress.Presets.shades_classic
    );
    this.processDataBar = new cliProgress.Bar(
      {},
      cliProgress.Presets.shades_classic
    );
    this.processDataIndex = 0;

    this.outputData = null;
    this.tempData = null;
  }
github smashtestio / smashtest / src / cli.js View on Github external
function generateProgressBar(clearOnComplete) {
                return new progress.Bar({
                    clearOnComplete: clearOnComplete,
                    barsize: 25,
                    hideCursor: true,
                    linewrap: true,
                    format: "{bar} {percentage}% | "
                }, progress.Presets.shades_classic);
            }
github anasrar / Samehadaku-Lewatin / module / dl.js View on Github external
req.on('response', (res) => {
        console.log('✅  ' + _colors.green('Server Response'))
        let size = parseInt(data.json.sizeBytes, 10),
            currentSize = 0,
            filename = decodeURIComponent(res.headers['content-disposition'].match(/filename\*?=['"]?(?:UTF-\d['"]*)?([^;\r\n"']*)['"]?;?/)[1])
        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', _ => {
            loadbar.stop()
            file.close()
            console.log('✅  ' + _colors.green('Success Download File : ' + filename))
github tom-james-watson / dat-cp / src / lib / pipe-streams.js View on Github external
return new Promise(async (resolve) => {

    const unit = getUnit(filesize)
    const unitLabel = getUnitLabel(unit)

    const labelWidth = (process.stdout.columns / 3).toFixed()
    label = label.substr(0, labelWidth).padEnd(labelWidth, ' ')

    const progress = new cliProgress.Bar({
      format: `${label} [${chalk.green('{bar}')}] {percentage}% | {duration_formatted} | {transfer}{unitLabel}`,
    }, cliProgress.Presets.legacy)

    progress.start(filesize, 0, {
      transfer: `${formatSize(0, {unit})} / ${formatSize(filesize, {unit})}`,
      unitLabel
    })

    readStream.on('data', function(buffer) {
      progress.increment(buffer.length, {
        transfer: `${formatSize(progress.value, {unit})}/${formatSize(filesize, {unit})}`,
      })
    })

    readStream.on('error', (err) => {
      progress.stop()
      logger.error(err.toString())
      logger.error('Failed to read file.')
github particl / particl-desktop / modules / clientBinaries / clientBinariesManager.js View on Github external
stream.on('downloadProgress', (info) => {
        if (progressBar) {
          progressBar.update(info.transferred);

          this.emit('download', {
            status: 'busy',
            transferred: info.transferred,
            total: info.total
          });

        } else {
          progressBar = new progress.Bar({}, progress.Presets.shades_classic);
          progressBar.start(info.total, info.transferred);

          this.emit('download', {
            status: 'started',
            transferred: info.transferred,
            total: info.total
          });

        }
      });
github skiptirengu / media-split / cli / Command.js View on Github external
createDefaultProgressBar (opts = {}) {
    const options = Object.assign({
      clearOnComplete: true,
      stopOnComplete: true
    }, opts)
    return new progress.Bar(options, progress.Presets.shades_classic)
  }
github Automattic / lab-assistant / lab-assistant.js View on Github external
async function performMeasurementSet( timingSet, versionString, url ) {
  const progress = new Progress.Bar({}, Progress.Presets.shades_classic);
  progress.start(options.repeat, 0);

  for ( let i = 0; i < options.throwaway; i++ ) {
    await load( url );
  }

  for ( let i = 0; i < options.repeat; i++ ) {
    const timings = await loadAndMeasure( url );
    timingSet.push( timings );
    progress.update( i + 1 );
  }
  progress.stop();

  const values = timingSet.map( timings => calculateMetric( timings, options.metric ) );
  const mean = calculateMean( values );

cli-progress

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

MIT
Latest version published 2 years ago

Package Health Score

70 / 100
Full package analysis