node-progress icon indicating copy to clipboard operation
node-progress copied to clipboard

Progress isn't working correctly (terminal issue and/or .update issue)

Open dantman opened this issue 10 years ago • 4 comments

With this code of mine:

var bar = new ProgressBar('  :status [:bar] :percent :etas', { total: 100 });
// Later as part of a `request()` call
    .pipe(progressStream({time: 100}))
    .on('progress', function(p) {
        bar.update(p.progress / 100, {status: 'Downloading'});
    })

I get this result: screen shot 2015-03-02 at 7 59 53 pm

First problem. Bar updates appear on new lines instead of being updated. Perhaps an incompatibility with OSX's terminal.

Second problem. There is currently a bug with request+progress-stream when gzip is in use (as in my case) that causes the progress event to not know what the actual progress is and as a result have to report progress: 0 until the end when it can finally report one progress: 100.

This means the bar should stay at 0% the whole time and then jump all the way to 100%. However this bar is instead incrementing by one tick each time as if it's completely ignoring the argument to .update.

dantman avatar Mar 03 '15 04:03 dantman

Ignore the second problem. That was my fault, wrong property.

However the first problem still exists. And it seems related to a miscalculation of the console width. The :eta wraps causing the next render to start on that line and continue downwards.

dantman avatar Mar 03 '15 04:03 dantman

Thanks for reporting we will look into it :-)

hallas avatar Mar 03 '15 09:03 hallas

FYI: same issue in GitBash / GitShell on Windows, when the Windows / terminal buffer is too narrow to accommodate the full progress bar width, causing text wrap and subsequently messing-up with process.stderr.clearLine/write/cursorTo()

danielweck avatar Mar 12 '15 10:03 danielweck

@dantman and @hallas i'm using this module and as mentioned in the initial post (first problem) the bar is getting updated for me but i see empty returns on the terminal before i push the success message, something like below, downloading [====================] 100% 0.0s
















file has been written to /~PATH~

@danielweck any resolution? please let me know..

prashathsenthil avatar Jun 24 '16 20:06 prashathsenthil