Flexible progress bar for terminal
- custom template
- render progress bar to buffer
- use react-hooks in ink
Multiple progress bar
import { MultiProgressBar } from 'mpb';
const multi = MultiProgressBar.create({
title: 'progress'
});
const bar = multi.createBar({
title: 'bar 1'
});
const timer = setInterval(() => {
bar.tick(1);
}, 100);
bar.events.on('complete-post', () => {
clearInterval(timer);
});
const bar2 = multi.createBar({
title: 'bar 2',
clean: true
});
const timer2 = setInterval(() => {
bar2.tick(1);
}, 50);
bar2.events.on('complete-post', () => {
clearInterval(timer2);
});
Single progress bar
import { ProgressBar } from 'mpb';
const bar = ProgressBar.create({
title: 'progress'
});
const timer = setInterval(() => {
bar.tick(1);
}, 100);
bar.events.on('complete-post', () => {
clearInterval(timer);
});
Use the theme
import { ProgressBar, themes } from 'mpb';
ProgressBar.create({
title: 'progress',
render: themes.inverse,
});
yarn build
cd examples
yarn
ts-node src/multi.ts