# loading-cli

> Terminal loading effect.

Latest version **1.1.2** (published 2023-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install loading-cli
pnpm add loading-cli
yarn add loading-cli
bun add loading-cli
```

## Health

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

Positive: no vulnerabilities; has provenance.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 1.1.2 |
| Published | 2023-11-27 |
| First published | 2016-05-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 10.3 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Provenance | attested (GitHub Actions) |
| GitHub stars | 56 |
| Author | kenny wang |
| Maintainers | wcjiang |
| Keywords | command, loading-cli, loading, exit, quit, process, graceful, shutdown, sigterm, sigint, cli, cursor, ansi, term, terminal, console, shell, command-line |

## Links

- npm: https://www.npmjs.com/package/loading-cli
- Repository: https://github.com/jaywcjlove/loading-cli
- Homepage: http://jaywcjlove.github.io/loading-cli
- Issues: https://github.com/jaywcjlove/loading-cli/issues
- Funding: https://jaywcjlove.github.io/#/sponsor
- npm.io page: https://npm.io/package/loading-cli

## Dependencies (1)

- [colors-cli](https://npm.io/package/colors-cli.md) ^1.0.26

## 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

- 1.1.2 (latest) — 2023-11-27
- 1.1.1 — 2023-10-16
- 1.1.0 — 2019-11-06
- 1.0.8 — 2018-06-12
- 1.0.7 — 2018-06-10
- 1.0.6 — 2018-01-20
- 1.0.4 — 2017-08-19
- 1.0.3 — 2017-08-17
- 1.0.2 — 2016-05-27
- 1.0.1 — 2016-05-26
- 1.0.0 — 2016-05-26

## README

# loading-cli

[![Buy me a coffee](https://img.shields.io/badge/Buy%20me%20a%20coffee-048754?logo=buymeacoffee)](https://jaywcjlove.github.io/#/sponsor)
[![](https://jaywcjlove.github.io/sb/ico/npm.svg)](https://www.npmjs.com/package/loading-cli)
[![CI](https://github.com/jaywcjlove/loading-cli/actions/workflows/ci.yml/badge.svg)](https://github.com/jaywcjlove/loading-cli/actions/workflows/ci.yml)

Terminal loading effect.

<img height="26" src="https://user-images.githubusercontent.com/1680273/68320716-70f33600-00fb-11ea-8a78-47b82ab28240.gif">

# Install

```bash 
$ npm install --save loading-cli
```

# Usage

```js 
const loading =  require('loading-cli');
const load = loading("loading text!!").start()

setTimeout(function(){
    load.color = 'yellow';
    load.text = ' Loading rainbows';
},2000)

// stop
setTimeout(function(){
    load.stop()
},3000)
```

Custom text color [colors-cli](https://github.com/jaywcjlove/colors-cli)

```js
const color = require('colors-cli/toxic');
const loading = require('loading-cli');

const load = loading("loading text!!".blue).start();
// stop
setTimeout(function(){
  load.stop()
},3000)
```

# API

## loading([options|text])

### options 

```js
load({
  "text":"loading text!!",
  "color":"yellow",
  "interval":100,
  "stream": process.stdout,
  "frames":["◰", "◳", "◲", "◱"]
})
```

### text

Type: string
Text to display after the spinner.

```js
loading("loading text!!")
```

## color

Values:`black` `red` `green` `yellow` `blue` `magenta` `cyan` `white` `gray`   


## frames

```bash
["◰", "◳", "◲", "◱"]
["◐", "◓", "◑", "◒"]
[".", "o", "O", "°", "O", "o", "."]
["⊶", "⊷"]
["ဝ", "၀"]
["←", "↖", "↑", "↗", "→", "↘", "↓", "↙"]
["🕐 ", "🕑 ", "🕒 ", "🕓 ", "🕔 ", "🕕 ", "🕖 ", "🕗 ", "🕘 ", "🕙 ", "🕚 "]
```

# Instance

## .start([text])

Start the spinner. Returns the instance.

## .stop()

Stop and clear the spinner. Returns the instance.

## .clear()

Clear the spinner. Returns the instance.

## .succeed([text])

Stop the spinner, change it to a green `✔` and persist the current text, or text if provided. Returns the instance. See the GIF below.

## .fail([text])

Stop the spinner, change it to a red `✖` and persist the current text, or text if provided. Returns the instance. See the GIF below.

## .warn([text])

Stop the spinner, change it to a yellow `⚠` and persist the current text, or text if provided. Returns the instance.

## .info([text])

Stop the spinner, change it to a blue `ℹ` and persist the current text, or text if provided. Returns the instance.

## .render()

Manually render a new frame. Returns the instance.

## .frame()

Get a new frame.

```js
const loading = require('loading-cli');
const load = loading("loading text!!");
load.frame(["◰", "◳", "◲", "◱"]);
load.start();
```

## .text

Change the text.

## .color

Change the spinner color.

## Contributors

As always, thanks to our amazing contributors!

<a href="https://github.com/jaywcjlove/loading-cli/graphs/contributors">
  <img src="https://jaywcjlove.github.io/loading-cli/CONTRIBUTORS.svg" />
</a>

Made with [contributors](https://github.com/jaywcjlove/github-action-contributors).

## License

Licensed under the MIT License.

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