Closed shixiaobao17145 closed 3 years ago
Good idea! I need some time to think.
already updated
import { MultiProgressBar } from "https://deno.land/x/progress@v1.2.3/mod.ts";
const title = 'download files';
const total = 100;
const bars = new MultiProgressBar({
title,
// clear: true,
complete: '=',
incomplete: '-',
display: '[:bar] :text :percent :time :completed/:total'
});
let completed1 = 0;
let completed2 = 0;
function downloading() {
if (completed1 <= total || completed2 <= total) {
completed1 += 1
completed2 += 2
bars.render([
{ completed: completed1, total, text: "file1" },
{ completed: completed2, total, text: "file2" }
]);
setTimeout(function () {
downloading();
}, 100)
}
}
downloading();
You can also change the style of the progress bar
bars.render([
{
completed: completed1,
total,
text: "file1",
complete: "*",
incomplete: ".",
},
{ completed: completed2, total, text: "file2" },
]);
Thanks for making this library.
Sometimes we want to show multiple bars at a time, for example, if we program to download files, we want to show their progress on the console together. How to make that happen with this library? Thanks!