Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/bkniffler/tty-aware-progress
https://github.com/bkniffler/tty-aware-progress
Last synced: about 1 month ago
JSON representation
- Host: GitHub
- URL: https://github.com/bkniffler/tty-aware-progress
- Owner: bkniffler
- License: mit
- Created: 2018-12-12T12:03:50.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2018-12-12T13:06:08.000Z (about 6 years ago)
- Last Synced: 2024-04-26T00:10:02.157Z (9 months ago)
- Language: TypeScript
- Size: 62.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# tty-aware-progress
[![Build Status](https://travis-ci.org/bkniffler/tty-aware-progress.png?branch=master)](https://travis-ci.org/bkniffler/tty-aware-progress)The 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.
## Install
```bash
npm install tty-aware-progress
# or
yarn add tty-aware-progress
```## Use
`tty-aware-progress` will only need the total number of expected ticks like shown below. It returns a function that emits progress.
```js
import createProgress from 'tty-aware-progress';const progress = createProgress(100);
for (var i = 0; i < 100; i++) {
progress();
}// OR
const progress = createProgress(100);
for (var i = 0; i < 10; i++) {
progress(10);
}
```