UNPKG

856 BMarkdownView Raw
1# tty-aware-progress
2[![Build Status](https://travis-ci.org/bkniffler/tty-aware-progress.png?branch=master)](https://travis-ci.org/bkniffler/tty-aware-progress)
3
4The excellent `progress` package from npm will unfortunately ignore non-TTY environments like CI (circle-ci, travis, etc). This package uses `progress`, but in case of non-TTY, the progress will be output as rolling logs.
5
6## Install
7
8```bash
9npm install tty-aware-progress
10# or
11yarn add tty-aware-progress
12```
13
14## Use
15
16`tty-aware-progress` will only need the total number of expected ticks like shown below. It returns a function that emits progress.
17
18```js
19import createProgress from 'tty-aware-progress';
20
21const progress = createProgress(100);
22for (var i = 0; i < 100; i++) {
23 progress();
24}
25
26// OR
27
28const progress = createProgress(100);
29for (var i = 0; i < 10; i++) {
30 progress(10);
31}
32```