https://github.com/articulate/progress
Cheap, functional, terminal progress bar
https://github.com/articulate/progress
functional-programming javascript progress-bar
Last synced: 2 months ago
JSON representation
Cheap, functional, terminal progress bar
- Host: GitHub
- URL: https://github.com/articulate/progress
- Owner: articulate
- License: mit
- Created: 2017-11-15T19:43:19.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-15T20:33:31.000Z (over 8 years ago)
- Last Synced: 2025-04-08T22:02:15.846Z (about 1 year ago)
- Topics: functional-programming, javascript, progress-bar
- Language: JavaScript
- Homepage:
- Size: 27.3 KB
- Stars: 0
- Watchers: 60
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# @articulate/progress
[](https://www.npmjs.com/package/@articulate/progress)
[](https://travis-ci.org/articulate/progress)
[](https://coveralls.io/github/articulate/progress?branch=master)
[](https://nodesecurity.io/orgs/articulate/projects/172aa9db-55a1-4f0d-b76e-2408bf81d4fa)

Cheap, functional, terminal progress bar.
Next time you're tempted to `process.stderr.write('.')` to track the progress of a script... don't. Use this instead.
## API
```haskell
progress : Object -> Number -> ()
```
To setup your progress bar, execute the module with an optional options object:
```js
const progress = require('@articulate/progress')({ /* options here */ })
```
The following options are accepted:
| Name | Type | Default | Description |
| ---- | ---- | ------- | ----------- |
| `label` | `String` | `'progress'` | custom label for your progress bar |
| `stream` | `stream.Writable` | `process.stderr` | output stream for progress |
| `width` | `Number` | `24` | max width of the bar |
The returned function accepts a progress ratio between `0` and `1`, and writes the progress bar to the output stream. Each time it is called, it will overwrite the previous state of the progress to appear animated in the console.
```js
const progress = require('@articulate/progress')()
progress(0.55)
//> progress: ⣠ [============== ] 55%
```
See [`demo.js`](https://github.com/articulate/progress/blob/master/demo.js) for a slightly more complex example.