How to use the cli-progress.Presets.shades_classic 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 macor161 / quantal / src / compiler / load-compiler.js View on Github external
return new Promise((res, rej) => {
    const fileName = getCompilerFilename(version)

    console.log(`Downloading ${fileName}...`)

    const request = require('request')
    const progress = require('request-progress')
    const { Bar, Presets } = require('cli-progress')

    const url = `${DOWNLOAD_URL}/${version}/${fileName}`
    const filePath = path.resolve(qconfig.getSolcCachePath(), fileName)
    const progressBar = new Bar({}, Presets.shades_classic)

    progressBar.start(100, 0)

    const fileRequest = progress(request(url), {
      throttle: 500,
    }).on('progress', state => {
      progressBar.update(parseInt(state.percent * 100, 10))
    })
      .on('response', response => {
        if (response.statusCode === 200) {
          const fileStream = createWriteStream(filePath)
            .on('finish', () => {
              fileStream.close(() => {
                res(filePath)
              })
            })
github kirinnee / CyanPrint / src / classLibrary / GlobFactory.ts View on Github external
async ReadFiles(files: FileSystemInstance[]): Promise {
		
		let readBar: Bar = new Bar({}, Presets.shades_classic);
		let readCounter: number = 0;
		readBar.start(files.length, readCounter);
		
		let promises: Promise[] = [];
		
		files.Each((f: FileSystemInstance) => promises.push(this.fileFactory.ReadFile(f, function () {
			readCounter++;
			readBar.update(readCounter);
			if (readCounter >= readBar.getTotal()) {
				readBar.stop();
			}
		})));
		return await Promise.all(promises);
	}

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