# @dinoabsoluto/flex-progress

> Progress indicator for Node.js

Latest version **2.4.0** (published 2019-05-03) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @dinoabsoluto/flex-progress
pnpm add @dinoabsoluto/flex-progress
yarn add @dinoabsoluto/flex-progress
bun add @dinoabsoluto/flex-progress
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities; high quality score.

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.4.0 |
| Published | 2019-05-03 |
| First published | 2019-04-10 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 52.7 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Author | Dino |
| Maintainers | dinoabsoluto |
| Keywords | cli, terminal, console, progressbar, progress, spinner, indicator, flex |

## Links

- npm: https://www.npmjs.com/package/@dinoabsoluto/flex-progress
- Repository: https://github.com/dino-absoluto/flex-progress-js
- Homepage: https://github.com/dino-absoluto/flex-progress-js#readme
- Issues: https://github.com/dino-absoluto/flex-progress-js/issues
- npm.io page: https://npm.io/package/@dinoabsoluto/flex-progress

## Alternatives

- [@salesforce/cli](https://npm.io/package/@salesforce/cli.md) — 389.7K weekly downloads
- [@mintlify/cli](https://npm.io/package/@mintlify/cli.md) — 208.9K weekly downloads
- [@grafana/e2e-selectors](https://npm.io/package/@grafana/e2e-selectors.md) — 128.7K weekly downloads
- [mintlify](https://npm.io/package/mintlify.md) — 112.0K weekly downloads
- [@intlayer/cli](https://npm.io/package/@intlayer/cli.md) — 22.8K weekly downloads

## Recent versions

- 2.4.0 (latest) — 2019-05-03
- 2.3.0 — 2019-05-02
- 2.2.2 — 2019-04-20
- 2.2.1 — 2019-04-19
- 2.2.0 — 2019-04-18
- 2.1.0 — 2019-04-18
- 2.0.1 — 2019-04-14
- 2.0.0 — 2019-04-12
- 1.3.4 — 2019-04-12
- 1.3.3 — 2019-04-12
- 1.3.2 — 2019-04-12
- 1.3.1 — 2019-04-12
- 1.3.0 — 2019-04-12
- 1.2.0 — 2019-04-10

## README

# flex-progress

> CLI progress bar made simple

[![Build Status](https://travis-ci.org/dino-absoluto/flex-progress-js.svg?branch=master)](https://travis-ci.org/dino-absoluto/flex-progress-js)
[![Coverage Status](https://coveralls.io/repos/github/dino-absoluto/flex-progress-js/badge.svg?branch=master)](https://coveralls.io/github/dino-absoluto/flex-progress-js?branch=master)
[![npm version](https://badge.fury.io/js/%40dinoabsoluto%2Fflex-progress.svg)](https://badge.fury.io/js/%40dinoabsoluto%2Fflex-progress)

An object-oriented approach to progress bar.

- **Simple:** no template, no ticking, just change the `ratio` property and
you're good to go.
- **Theme:** personalize with colors and style.
- **Object-oriented:** each element is an object, updating its data leads to
updating the output.
No need to care about what other elements are doing.

```javascript
const FlexProgress = require('@dinoabsoluto/flex-progress')
// ESModules or Typescript
// import * as FlexProgress from '@dinoabsoluto/flex-progress'

const out = new FlexProgress.Output()
const bar = new FlexProgress.Bar({ width: 25 })

out.append(
  1, new FlexProgress.Spinner(),
  1, 'Hello World!',
  1, new FlexProgress.Spinner(),
  1, '⸨', bar, '⸩'
)

let count = 0
const loop = setInterval(() => {
  count++
  bar.ratio = (count % 39) / 38
}, 80)

```

<img width="450" height="50"
src="docs/media/demo-1-edited.gif" />

<img width="450" height="50"
src="docs/media/demo-2-edited.gif" />

<img width="450" height="50"
src="docs/media/demo-3-edited.gif" />

**NOTE:** The images above are screen captures of the demos in folder examples.

## Concept: Why is it *flex*-progress?
This was inspired by CSS Flexbox concept, although much simpler.

Basically, all elements have `flexShrink` and `flexGrow` properties,
which controls how much they shrink/grow. (`flex` is a shorthand for both)

In most case, you'll want your progress `Bar` to have fixed width and a `Text`
with `flexShrink` set to 1. This way, your text will fill up the
CLI width, but will truncate at the end of the line.

## Usage
See [documents](docs/index.md) for more details.

For a simple explanation see this [example](examples/tutorial.js).

---
_Source: https://npm.io/package/@dinoabsoluto/flex-progress · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
