Skip to content

Instantly share code, notes, and snippets.

@kasterra
Created August 9, 2022 09:20
Show Gist options
  • Save kasterra/026f845f1d0f65a73f40e5b9a67a2cce to your computer and use it in GitHub Desktop.
Save kasterra/026f845f1d0f65a73f40e5b9a67a2cce to your computer and use it in GitHub Desktop.
singleProgressBarTest
import { SingleBar } from "cli-progress";
// create new progress bar
const b1 = new SingleBar({
format:
"CLI Progress {name}|" +
"{bar}" +
"| {percentage}% || {value}/{total} Chunks",
barCompleteChar: "\u2588",
barIncompleteChar: "\u2591",
noTTYOutput: true,
});
const b2 = new SingleBar({
format:
"CLI Progress {name}|" +
"{bar}" +
"| {percentage}% || {value}/{total} Chunks",
barCompleteChar: "\u2588",
barIncompleteChar: "\u2591",
noTTYOutput: true,
});
b1.start(200, 0, {
name: "eeee",
});
b2.start(200, 0, {
name: "aaaa",
});
console.log(b1.payload);
let val = 20;
// update values
b1.increment();
b2.increment();
b1.update(val);
b2.update(val);
console.log("\n111");
await new Promise((resolve, reject) => {
const id = setInterval(() => {
console.log("\nhurray");
b2.update(val);
b1.update((val += 20));
if (val > 100) {
b1.stop();
b2.stop();
clearInterval(id);
resolve();
}
}, 1000);
});
console.log("end");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment