https://github.com/jakobhellermann/deno-progressbar
a terminal progressbar for deno
https://github.com/jakobhellermann/deno-progressbar
Last synced: about 1 year ago
JSON representation
a terminal progressbar for deno
- Host: GitHub
- URL: https://github.com/jakobhellermann/deno-progressbar
- Owner: jakobhellermann
- License: mit
- Created: 2020-05-16T11:37:04.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2020-05-29T09:25:30.000Z (about 6 years ago)
- Last Synced: 2025-04-12T23:54:02.078Z (about 1 year ago)
- Language: TypeScript
- Size: 1.13 MB
- Stars: 5
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# progressbar
> deno progress bars for the terminal

## Usage
```typescript
import ProgressBar from "https://deno.land/x/progressbar@v0.2.0/progressbar.ts";
import {
percentageWidget,
amountWidget,
} from "https://deno.land/x/progressbar@v0.2.0/widgets.ts";
const sleep = (ms: number) => new Promise((resolve) => setTimeout(resolve, ms));
const widgets = [percentageWidget, amountWidget];
const pb = new ProgressBar({ total: 200, widgets });
for (let i = 0; i < pb.total; i++) {
await pb.update(i);
await sleep(50);
}
await pb.finish();
```
You can also create widgets yourself, they are just a function which, given the total and current value, returns a string.
```typescript
const percentWidget = (i, total) => `${(i / total * 100)%`;
```
## License
MIT © [Jakob Hellermann](mailto:jakob.hellermann@protonmail.com)