GithubHelp home page GithubHelp logo

bubkoo / ascii-progress Goto Github PK

View Code? Open in Web Editor NEW
206.0 4.0 26.0 6.84 MB

๐Ÿ“ Ascii progress-bar(s) in the terminal.

License: MIT License

Shell 0.99% TypeScript 99.01%
ascii progress progress-bar nodejs

ascii-progress's Introduction

ascii-progress

Ascii progress-bar(s) in the terminal.

MIT License Language PRs Welcome

Features:

  • Support multi progress-bars.
  • Relative and absolute width.
  • Colorful bar and text.
  • Highly customizable.

snapshot

Install

$ npm install ascii-progress

Usage

For more usage see the examples

const { ProgressBar } = require('ascii-progress');

const bar = new ProgressBar({
    schema: ':bar',
    total : 10,
});

const iv = setInterval(function () {
  bar.tick();
  if (bar.completed) {
    clearInterval(iv);
  }
}, 100);

Options

These are keys in the options object you can pass to the progress bar along with total as seen in the example above.

  • schema - template string of the progress bar. Default " [:bar] :current/:total :percent :elapseds :etas'".
  • total - total number of ticks to complete. Default 100.
  • current- number of completed ticks. Default 0.
  • width - display width, percentage or less than 1 is relative the terminal's width. Default 60.
  • fixedWidth - do not adjust the bar based on the terminal size
  • filled- completion character. Default "โ–‡".
  • blank - blank character. Default "-".
  • clean - clear the progress bar on completion. Default false.
  • callback - optional function to call when the progress bar completes.

Properties

  • schema
  • total
  • current
  • completed

Methods

  • setSchema(schema, refresh/tokens) - Update the schema of the progress bar. If refresh or tokens is truely the progress bar will be refreshed.

  • tick(delta, tokens) - Update ticks of the progress bar by delta, then render the progress bar with optional tokens.

  • update(ratio, tokens) - Update the progress bar to ratio by percentage, then render the progress bar with optional tokens.

  • clear() - Clean the progress bar in the terminal.

Schema

The schema defines appearance the progress bar. Few inner tokens and many formatting methods can be used to customer you progress bar.

Tokens

These are tokens you can use in the format of your progress bar.

  • :filled Completed part of the progress bar.
  • :blank Blank part of the progress bar.
  • :bar Whole progress bar, equal to :completed:blank.
  • :current Current tick number.
  • :total Total ticks.
  • :percent Completion percentage.
  • :elapsed Time elapsed in seconds.
  • :eta Estimated completion time in seconds.

Custom Tokens

You can define custom tokens by adding a {name: value} object parameter to your method (tick(), update(), etc.) calls.

const bar = new ProgressBar({
    schema: ':current: :token1 :token2',
    total : 3,
});
bar.tick({
  'token1': "Hello",
  'token2': "World!"
})
bar.tick(2, {
  'token1': "Goodbye",
  'token2': "World!"
})

The above example would result in the output below.

1: Hello World!
3: Goodbye World!

Colors

Color names can be use in schema:

:bar.red :percent.green

Then the progress bar will be red, and the percentage will be green.

All available color names:

  • red
  • cyan
  • blue
  • grey
  • white
  • black
  • green
  • yellow
  • magenta
  • brightRed
  • brightBlue
  • brightCyan
  • brightWhite
  • brightBlack
  • brightGreen
  • brightYellow
  • brightMagenta

And with the bg prefix, such as bgRed, the color will be applied to the background.

:bar.red.bgBlue

The above progress bar has blue background and red foreground.

Gradient

:bar.gradient(red,blue)

The arguments can be color names or hex color:

  • red
  • cyan
  • blue
  • grey
  • white
  • black
  • green
  • yellow
  • magenta
  • #xxxxxx

Font style

Same as color names, font style can also be assigned by name:

  • bold
  • italic
  • inverse
  • underline
:bar.red :percent.green.bold

The percentage is green and bold.

Contributing

Please let us know how can we help. Do check out issues for bug reports or suggestions first.

To become a contributor, please follow our contributing guide.

Contributors

License

The scripts and documentation in this project are released under the MIT License

ascii-progress's People

Contributors

bubkoo avatar dependabot[bot] avatar jacobwgillespie avatar legraphista avatar nitin42 avatar rogeriochaves avatar vivcat[bot] avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

ascii-progress's Issues

node throws few erros

First I got this error:

.../node_modules/ascii-progress/index.js:468
return new Array(count + 1).join(char);
RangeError: Invalid array length

I fixed that error by replacing this...

return new Array(count + 1).join(char);

.. with this ...

return [(count + 1)].join(char);

Now I get the next error:

.../node_modules/ascii-progress/index.js:439
this.cursor.moveTo(this.savePos.row, this.savePos.col);
TypeError: Cannot read property 'row' of undefined

Any idea how to fix it?
I'm running node v4.4.7 on OSX 10.11.5

Runtime error

Got this error:

 => Suman fatal error (domain caught) => TypeError: Cannot read property 'row' of undefined
    at Socket.<anonymous> (/Users/Olegzandr/WebstormProjects/oresoftware/suman/node_modules/node-progress-bars/index.js:34:14)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Socket.stream.write (/Users/Olegzandr/WebstormProjects/oresoftware/suman/node_modules/on-new-line/index.js:49:14)
    at Object.runnerLog [as log] (/Users/Olegzandr/WebstormProjects/oresoftware/suman/lib/sync-logger.js:22:24)
    at runSingleOrMultipleDirs (/Users/Olegzandr/WebstormProjects/oresoftware/suman/lib/runner.js:1129:22)
    at /Users/Olegzandr/WebstormProjects/oresoftware/suman/lib/runner.js:1166:13
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickDomainCallback (internal/process/next_tick.js:122:9)

/Users/Olegzandr/WebstormProjects/oresoftware/suman/node_modules/node-progress-bars/index.js:34
  if (current.row < stream.rows) {
             ^

TypeError: Cannot read property 'row' of undefined
    at Socket.<anonymous> (/Users/Olegzandr/WebstormProjects/oresoftware/suman/node_modules/node-progress-bars/index.js:34:14)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:188:7)
    at Socket.stream.write (/Users/Olegzandr/WebstormProjects/oresoftware/suman/node_modules/on-new-line/index.js:49:14)
    at process.<anonymous> (/Users/Olegzandr/WebstormProjects/oresoftware/suman/lib/handle-exit.js:47:28)
    at emitOne (events.js:101:20)
    at process.emit (events.js:188:7)
    at process.exit (internal/process.js:146:15)
    at Domain.<anonymous> (/Users/Olegzandr/WebstormProjects/oresoftware/suman/lib/run.js:185:15)
    at Domain.g (events.js:286:16)

via this code:

//core
const util = require('util');

//npm
const ProgressBar = require('node-progress-bars');
const suman = require('suman');

////////////////////////////////////////


module.exports = s => {

  var progressBar;

  s.on('runner-started', function onRunnerStart (totalNumTests) {

    progressBar = new ProgressBar({
      schema: ':bar',
      total: 10
    });

  });


  s.on('test-end', function onTestEnd () {
    progressBar.tick();
  });

  s.on('runner-end', function onRunnerEnd () {

  });

  s.on('suite-skipped', function onRunnerEnd () {

  });

  s.on('suite-end', function onRunnerEnd () {

  });

};

Each update is on a new line

There is a bug that when the bar is ticked it creates a new bar on a new line.

I am using Windows 10 and node 8

PS C:\repo\unsorted\curl-uploader> node .\index.js
Creating Documents: [โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”] 1/3 0.0
Creating Documents: [โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”] 2/3 0.5
Creating Documents: [โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡] 3/3 0.0
Creating Assets: [โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”] 1/3 0.0
Creating Assets: [โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”] 2/3 3.6
Creating Assets: [โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡] 3/3 0.0

Error after basic npm i

nickshevr@nickshevr-work:~/CloudTech/smarty-migrate$ npm i --save-dev ascii-progress

> [email protected] install /home/nickshevr/CloudTech/smarty-migrate/node_modules/ascii-progress/node_modules/get-cursor-position
> node-gyp rebuild

make: Entering directory '/home/nickshevr/CloudTech/smarty-migrate/node_modules/ascii-progress/node_modules/get-cursor-position/build'
  CXX(target) Release/obj.target/pos/src/pos.o
../src/pos.cc: In function โ€˜void Method(const v8::FunctionCallbackInfo<v8::Value>&)โ€™:
../src/pos.cc:259:6: warning: variable โ€˜retโ€™ set but not used [-Wunused-but-set-variable]
  int ret, row, col;
      ^
  SOLINK_MODULE(target) Release/obj.target/pos.node
  COPY Release/pos.node
make: Leaving directory '/home/nickshevr/CloudTech/smarty-migrate/node_modules/ascii-progress/node_modules/get-cursor-position/build'
[email protected] /home/nickshevr/CloudTech/smarty-migrate
โ”œโ”€โ”ฌ [email protected] 
โ”‚ โ””โ”€โ”€ [email protected] 
โ””โ”€โ”€ UNMET PEER DEPENDENCY [email protected]
npm WARN [email protected] requires a peer of eslint@^2.9.0 but none was installed.
npm WARN [email protected] No repository field.

After this I start nodeJS script:

nickshevr@nickshevr-work:~/CloudTech/smarty-migrate$ node ./migrations/001-newChatModelMigrate.js 
module.js:457
    throw err;
    ^

Error: Cannot find module './build/release/pos'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/nickshevr/CloudTech/smarty-migrate/node_modules/get-cursor-position/index.js:1:74)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/nickshevr/CloudTech/smarty-migrate/node_modules/node-progress-bars/index.js:4:20)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/nickshevr/CloudTech/smarty-migrate/migrations/001-newChatModelMigrate.js:5:21)
    at Module._compile (module.js:556:32)

repeatChar crashing if count is float

When I use tick() on my progressBar I get

RangeError: Invalid array length
    at repeatChar (/Users/sales/Dev/xxxxxxx/2017/tools/cloud-backup/src/node_modules/ascii-progress/index.js:473:10)

and the value of "count" is 104.60000000000002.

I've patched it by parseInt count in:


function repeatChar(count, char) {
  console.log(count);
  return new Array(parseInt(count) + 1).join(char);
  // return new Array(count + 1).join(char);
}

Can you please fix in repo? Thanks!

is this a unix only package?

on windows 10 you get

PS C:\Repos\grazper.platform\grazper.platform.node> npm install ascii-progress

...

..\src\pos.cc(6): fatal error C1083: Cannot open include file: 'unistd.h': No such file or directory

...

Using multiple progressbars with node cluster

I really like this project and with multiple bars without use of cluster it works perfect.

But if I try to use it in clustermode i got weird. I think its related to the ProgressBar object references but not sure.

Has anyone an idea how this can be done?

I prepared a litte example to demonstrate the scenario:

runC() => does the progressbars for cluster mode which works not :/
runN() => does the progressbars without cluster mode which works

const cluster = require('cluster'),
  ProgressBar = require('ascii-progress');

const bars = {};

async function job(myNum) {
  const timer = setInterval( () => {
      bars[myNum].tick();
      if (bars[myNum].completed) {
        clearInterval(timer);
      }
    }, 150);
}

function createBars(data) {
  for (let i = 0; i < data.length; i++) {
    bars[data[i]] = new ProgressBar({
      schema: `${ data[i] } [:bar.gradient(green,magenta)] :percent`,
      total: data[i]
    });
  }
}

async function runC() {
  const data = [10,20,30];
  createBars(data);

  if (cluster.isMaster) {
    for (let i = 0; i < 3; i++) {
      cluster.fork({special_data: data.pop()});
    }
  } else {
    job(process.env.special_data);
  }
}

async function runN() {
  const data = [10,20,30];
  createBars(data);

  for (let i = 0; i < 3; i++) {
    job(data.pop());
  }
}

// runC();
// runN();

Progress display messes up on console input

I've noticed that with any of the examples, but especially multi-bar ones, that if I start typing while the progress bars are moving, the console just gets filled with uninterpreted ANSI escape sequences on every tick, and the bar rendering completely breaks.

I don't see a need to accept typed input during progress monitoring, except perhaps ESC to cancel, but the console rendering positions should not break down.

I'm running the examples in a Mac Terminal window with Bash if that makes a difference.

Cannot find module './build/release/pos'

Edit 2: This error is already fixed by a Pull Request for get-cursor-position:
bubkoo/get-cursor-position@09b4013

I get this error:

Error: Cannot find module './build/release/pos'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/home/ascii-progress/node_modules/get-cursor-position/index.js:1:74)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)

Edit: I'm using node.js v6.0.0

Weird caracters show up before progress bar

  • node v 6.3.0
  • inside a fiber or not...
  • when doing a console.log after progress ended
  • have weird "๏ฟฝ[-1;1" showing up before the progress bar and messing up all the formating (line is wrapped)

Here is a sample code to reproduce it (using sync module for fiber).
Actually it does the same to me even outside a fiber!

let Sync = require('sync');
let ProgressBar = require('ascii-progress');

Sync(function () {

    let bar = new ProgressBar({
        schema: ':bar',
        total: 100
    });

    var iv = setInterval(function () {
        bar.tick();
        if (bar.completed) {
            clearInterval(iv);
            console.log('woops!');
        }
    }, 10);
});

End up in:

๏ฟฝ[-1;1Hโ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡
woops!

ETA not accurate

I may be using it wrong, but it looks like the ETA isn't exactly updating itself properly. When running a process, the ETA starts out (in this example) around 20 seconds but then fluctuates around 30 and 15 and ends somewhere in there as well. It's as though the ETA is from that snapshot at that instant and not guessing how long the remaining time will take based on the speed of what's already happened.

Hangs when there is no TTY

If there is no TTY, i.e. !process.stdout.isTTY, this hangs.

It might be wise to do nothing if there is no TTY.

Just stops after a while and ends the process

Hi I used it under Mac OS 10.13.3 with node v9.5.0
When running it with a bigger amount of cycles it crashes after a while.

This example code shows the problem:

const ProgressBar = require('ascii-progress')

const TOTAL_TESTCASE = 251
const TOTAL_STEPS = 628

const barTestcase = new ProgressBar({
    schema:
        'Test cases: [:bar.yellow] :current/:total :percent :elapseds :etas <:name>',
    total: TOTAL_TESTCASE,
    clear: false,
})

const barStep = new ProgressBar({
    schema:
        'Steps:      [:bar.green] :current/:total :percent :elapseds :etas <:name>',
    total: TOTAL_STEPS,
    clear: false,
})

// make the bars Visible in the right order
barTestcase.tick()
barTestcase.tick(-1)

barStep.tick()
barStep.tick(-1)


for(let stepCount =0; stepCount<TOTAL_STEPS; stepCount++){
    barStep.tick()
    for(let tcCount =0; tcCount<TOTAL_TESTCASE; tcCount++){
        barTestcase.tick()
    }
    barTestcase.tick(-TOTAL_TESTCASE)
}

ProgressBar instances not garbage collected

I wanted to simulate showing the progress of downloading hundreds of files but throttled to a small number of simultaneous downloads, so I created a simple example: https://gist.github.com/erhhung/3b8bdcbac3004907acf28de40a1cf21a

It seems that new ProgressBar instances are continuously being pushed onto the global instances[] array but never removed. I haven't looked into the code in detail to locate resource leaks, though the heap usage seems to be fairly stable.

I do see a couple of .forEach() loops on the instances[] array, so it will unnecessarily check more and more completed bars over time.

Fails to install under Windows

I'm using Git BASH. Running npm install ascii-progress gives:

> [email protected] install C:\[REDACTED]\node_modules\ascii-progress\node_modules\get-cursor-position
> node-gyp rebuild


C:\[REDACTED]\node_modules\ascii-progress\node_modules\get-cursor-position>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe". To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visual Studio 2005 or 3) add the location of the component to the system path if it is installed elsewhere.  [C:\[REDACTED]\node_modules\ascii-progress\node_modules\get-cursor-position\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\[REDACTED]\node_modules\ascii-progress\node_modules\get-cursor-position
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
npm ERR! Windows_NT 10.0.10586
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "ascii-progress" "--save-dev"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script 'node-gyp rebuild'.
npm ERR! This is most likely a problem with the get-cursor-position package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs get-cursor-position
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!
npm ERR!     npm owner ls get-cursor-position
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\[REDACTED]\npm-debug.log

Build failing on get-cursor-position

Greetings. I wasn't able to install this package because get-cursor-position fails to build.

Logs:

yarn add v1.22.4
[1/4] Resolving packages...
[2/4] Fetching packages...
[3/4] Linking dependencies...
[4/4] Building fresh packages...
error D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position: Command failed.
Exit code: 1
Command: node-gyp rebuild
Arguments: 
Directory: D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position
Output:
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position>if not defined npm_config_node_gyp (node "C:\Dev\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | win32 | x64
gyp info find Python using Python version 3.8.1 found at "C:\Dev\python\python.exe"
gyp info find VS using VS2019 (16.4.29806.167) found at:
gyp info find VS "C:\Program Files (x86)\Microsoft Visual Studio\2019\Community"
gyp info find VS run with --verbose for detailed information
gyp info spawn C:\Dev\python\python.exe
gyp info spawn args [
gyp info spawn args   'C:\\Dev\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\User Directories\\Code\\Projects\\<REDACTED>\\node_modules\\get-cursor-position\\build\\config.gypi', 
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Dev\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'C:\\Users\\<REDACTED>\\AppData\\Local\\node-gyp\\Cache\\13.9.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=C:\\Users\\<REDACTED>\\AppData\\Local\\node-gyp\\Cache\\13.9.0',
gyp info spawn args   '-Dnode_gyp_dir=C:\\Dev\\nodejs\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=C:\\\\Users\\\\<REDACTED>\\\\AppData\\\\Local\\\\node-gyp\\\\Cache\\\\13.9.0\\\\<(target_arch)\\\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\User Directories\\Code\\Projects\\<REDACTED>\\node_modules\\get-cursor-position',   
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\User Directories\\Code\\Projects\\<REDACTED>\\node_modules\\get-cursor-position\\build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe
gyp info spawn args [
gyp info spawn args   'build/binding.sln',
gyp info spawn args   '/clp:Verbosity=minimal',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=x64'
gyp info spawn args ]
Building the projects in this solution one at a time. To enable parallel build, please add the "-m" switch.
  win_delay_load_hook.cc
  pos.cc
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(272,76): error C2661: 'v8::Object::Set': no overloaded function takes 2 arguments [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(273,76): error C2661: 'v8::Object::Set': no overloaded function takes 2 arguments [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(277,11): error C2065: 'Handle': undeclared identifier [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(277,18): error C2275: 'v8::Object': illegal use of this type as an expression [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
C:\Users\๏ฟฝ๏ฟฝ๏ฟฝq๏ฟฝ๏ฟฝ๏ฟฝ{\AppData\Local\node-gyp\Cache\13.9.0\include\node\v8.h(3541): message : see declaration of 'v8::Object' [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(277,26): error C2065: 'exports': undeclared identifier [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(277,33): error C2182: 'Init': illegal use of type 'void' [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(277,35): error C2448: 'Init': function-style initializer appears to be a function definition [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\src\pos.cc(283,1): warning C4312: 'type cast': conversion from 'int' to 'node::addon_register_func' of greater size [D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position\build\pos.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\MSBuild\Current\Bin\MSBuild.exe` failed with exit code: 1 
gyp ERR! stack     at ChildProcess.onExit (C:\Dev\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (events.js:321:20)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Windows_NT 10.0.18363
gyp ERR! command "C:\\Dev\\nodejs\\node.exe" "C:\\Dev\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\User Directories\Code\Projects\<REDACTED>\node_modules\get-cursor-position
gyp ERR! node -v v13.9.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
info Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.

Python 3.8.1, Node.js 13.9.0, Yarn 1.22.4
Currently on Windows 10 Pro Build 1909 (OS Build 18363.657)

TypeError: Cannot read property 'row' of undefined

TypeError: Cannot read property 'row' of undefined
    at WriteStream.<anonymous> (/Users/.../node_modules/node-progress-bars/index.js:34:14)

This error is thrown when I have multiple iterations that exceeds the number of opened files allowed, EMFILE on mac.

reproduce:

const Progress = require('node-progress-bars')

const iterations = 15000
const prg = new Progress()
prg.total = iterations

for (let i = 0; i <= iterations; i++) {
  prg.tick()
}

result:

node test.js
 [โ–‡โ–‡โ–‡โ–‡โ–‡โ–‡โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”] 8783/15000 59% 11.9s 20.3s

for me it stops at around 8800

The error is not thrown in this example, for me it is thrown when I use it inside a Promise chain.

Bar Aligment

The current bar alignment does not allow the bar to stick to the right side of the screen like pacman in Arch.

I propose adding a ":spacer" option to the bar scheme so that the bar and the spacer change dynamically when the screen changes.

This will improve the overall user experience and make the bar more visually appealing.

Pacman

ascii progress is messing up the console input

Hi, Im using ascii progress to show a download, after download complete. Im showing a user text for confirmation (using inquirer library). When using ascii progress the inputs are not taken, please help me what should I do to take the user inputs.

Thanks

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.