pb

promise.bar

Progress bar to animate the status of a Promise.all

Showing:

Popularity

Downloads/wk

1

GitHub Stars

9

Maintenance

Last Commit

4yrs ago

Contributors

1

Package

Dependencies

3

License

MIT

Type Definitions

Tree-Shakeable

No?

Categories

Readme

Promise.bar

Promise.bar on NPM Build Status

Usage

Doing a bunch of tasks asynchronously with promises, and want a status indicator?

let compiles = [
  compile("a.coffee"),
  compile("b.coffee")
];
Promise.all(compiles).then(() => {
  console.log("Compile Done!");
});

Simply replace Promise.all with PromiseBar.all, and watch a progress bar fill as compilations finish!

let PromiseBar = require("promise.bar");
PromiseBar.enable();

PromiseBar.all(compiles, {label: "Minify"}).then(() -> {
  console.log("Compile Done!");
});

(Install PromiseBar via npm install --save promise.bar)

Alias as Promise.bar

Make PromiseBar even cuter.

Promise.bar = function() {
  return PromiseBar.all(arguments);
};

Stacked Progress Bars

Want to stack progress bars?

child = PromiseBar.all([], {label: "Child"});
parent = PromiseBar.all([child], {label: "Parent"});

The child will automatically be indented under the parent. Disable this for a progress bar by passing flat: false to PromiseBar#all, or disable it for all progress bars with PromiseBar.conf.flat = false;.

Color the Progress Bar

Add colors to your progress bars with libraries like Chalk.

let chalk = require("chalk");

PromiseBar.all([], {label: chalk.blue("Progress"), barFormat: chalk.dim.blue});

The label will be colored blue, and the progress bar will be light blue. You can provide any function to barFormat to transform the output.

Always Below console.log Content

Progress bars will always appear under other stdout content.

All Options

Promise.bar supports much more customization than the options listed here. Please check out the full API documentation for other configurable options.

Rate & Review

Great Documentation0
Easy to Use0
Performant0
Highly Customizable0
Bleeding Edge0
Responsive Maintainers0
Poor Documentation0
Hard to Use0
Slow0
Buggy0
Abandoned0
Unwelcoming Community0
100
No reviews found
Be the first to rate

Alternatives

No alternatives found

Tutorials

No tutorials found
Add a tutorial