Open
Description
I have a function where im looping over an array, to do some process this lead to see progress bar appearing in many line rather than show the progress on the same bar.
Could you provide an example how to do so when im using for loop
const bar = new cliProgress.SingleBar({
format: 'Processing |' + chalk.cyan('{bar}') + '| {percentage}% || {value}/{total} Pages || Current File: {filename}',
barCompleteChar: '\u2588',
barIncompleteChar: '\u2591',
hideCursor: true
}, cliProgress.Presets.shades_classic);
bar.start(pages.length, 0, {
filename: 'Starting...'
});
for (const page of pages) {
const pageName = page.FileLeafRef;
// Update the progress bar with the current file name and progress
bar.increment(1, {
filename: pageName
});
const pageContent = page.CanvasContent1;
if (pageContent) {
const cleanedContent = cleanHtml(decodedContent);
const outputPdfPath = `./${path.parse(pageName).name}.pdf`;
await convertHtmlToPdf(cleanedContent, outputPdfPath);
} else {
console.log(chalk.red(`Failed to retrieve content for page: ${pageName}\n`));
}
Metadata
Metadata
Assignees
Labels
No labels