mpb
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

MultiProgressBar

Flexible progress bar for terminal

Build Status

Features

  • custom template
  • render progress bar to buffer
  • use react-hooks in ink

Examples

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,
});

Custom render

more examples

Screenshot

Single progress bar

Single progress bar

Multiple progress bar

Multiple progress bar

Custom render

Custom render

Progress bar width logger

Progress bar width logger

Run examples

yarn build
cd examples
yarn
ts-node src/multi.ts

API docs

Package Sidebar

Install

npm i mpb

Weekly Downloads

1

Version

0.1.0

License

MIT

Unpacked Size

156 kB

Total Files

26

Last publish

Collaborators

  • raidou1