Security News
Bun 1.2 Released with 90% Node.js Compatibility and Built-in S3 Object Support
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
@badrap/bar-of-progress
Advanced tools
A small, easy & zero-dependency progress bar component.
$ npm i @badrap/bar-of-progress
Import the package and create a progress bar instance:
import ProgressBar from "@badrap/bar-of-progress";
const progress = new ProgressBar();
Show the progress bar and begin animating it by calling the .start()
method.
progress.start();
Note By default the progress bar does not appear immediately when
.start()
is called. Instead there is a 80 millisecond grace period, allowing very quickly completed tasks to avoid showing the progress bar. You can modify this (and other) behavior, see Customization.
End the progress bar animation by calling the .finish()
method:
setTimeout(() => {
progress.finish();
}, 1000);
You can reuse a progress
instance multiple times - every time .start()
gets called the progress bar starts animation from scratch.
The progress bar's appearance and behavior can be (slightly) customized with constructor parameters. Here are the different options and their default values:
const progress = new ProgressBar({
// The size (height) of the progress bar.
// Numeric values get converted to px.
size: 2,
// Color of the progress bar.
// Also used for the glow around the bar.
color: "#29e",
// Class name used for the progress bar element.
className: "bar-of-progress",
// How many milliseconds to wait before the progress bar
// animation starts after calling .start().
delay: 80,
});
This library is licensed under the MIT license. See LICENSE.
FAQs
A small, easy & zero-dependency progress bar component.
The npm package @badrap/bar-of-progress receives a total of 3,875 weekly downloads. As such, @badrap/bar-of-progress popularity was classified as popular.
We found that @badrap/bar-of-progress demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Bun 1.2 enhances its JavaScript runtime with 90% Node.js compatibility, built-in S3 and Postgres support, HTML Imports, and faster, cloud-first performance.
Security News
Biden's executive order pushes for AI-driven cybersecurity, software supply chain transparency, and stronger protections for federal and open source systems.
Security News
Fluent Assertions is facing backlash after dropping the Apache license for a commercial model, leaving users blindsided and questioning contributor rights.