Skip to content

In high frequency updates the loader shows up in between multibar logs #157

Description

@saikatmitra91

Code Snippet

const cliProgress = require("cli-progress");
const ProgressBar = cliProgress.MultiBar;

const multi = new ProgressBar({
  format:
    "Progress |" +
    "{bar}" +
    "| {percentage}% || {value}/{total} Chunks || Speed: {speed} || ETA: {eta}s",
  hideCursor: true,
  barCompleteChar: '\u2588',
    barIncompleteChar: '\u2591',
    clearOnComplete: true,
    stopOnComplete: true,
    forceRedraw: true
});

const bar1 = multi.create(100, 0);
const bar2 = multi.create(100, 0)

let i = 0;
const interval = setInterval(() => {
  // Simulate some process
  i++;

  // Print logs
  multi.log(`Log message ${i} \n`);

  // Update progress bar
  bar1.update(i);
  bar2.update(i);

  if (i === 100) {
    clearInterval(interval);
    multi.stop();
    console.log("All items processed!");
  }
}, 10);

Output
Screenshot 2024-04-10 at 5 27 19 PM

Expected

Screenshot 2024-04-10 at 5 32 26 PM

The logs should be clean with progress bar cleanly appearing at the bottom

please let me know If there is a way to mitigate this issue

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions