https://github.com/matheusviegas/cli-loading-animation
This library combines cli-spinners and log-update to display a loading animation in CLI apps made with Node.
https://github.com/matheusviegas/cli-loading-animation
cli-app loading loading-animations loading-spinner nodejs
Last synced: 5 months ago
JSON representation
This library combines cli-spinners and log-update to display a loading animation in CLI apps made with Node.
- Host: GitHub
- URL: https://github.com/matheusviegas/cli-loading-animation
- Owner: matheusviegas
- Created: 2022-05-20T00:06:40.000Z (about 4 years ago)
- Default Branch: main
- Last Pushed: 2022-05-20T12:43:40.000Z (about 4 years ago)
- Last Synced: 2025-08-09T03:22:57.261Z (11 months ago)
- Topics: cli-app, loading, loading-animations, loading-spinner, nodejs
- Language: TypeScript
- Homepage: https://www.npmjs.com/package/cli-loading-animation
- Size: 3.91 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# cli-loading-animation
This library combines [cli-spinners](https://www.npmjs.com/package/cli-spinners) and [log-update](https://www.npmjs.com/package/log-update) to display a loading animation in CLI apps made with Node.
### Install
```sh
# NPM
npm install cli-loading-animation
# Yarn
yarn add cli-loading-animation
```
### Example
```javascript
const { loading } = require('cli-loading-animation');
const { start, stop } = loading('Loading..');
start();
setTimeout(() => stop(), 3000);
```
### Custom Spinner
```javascript
const { loading } = require('cli-loading-animation');
const spinners = require('cli-spinners');
const { start, stop } = loading('Loading..', { clearOnEnd: false, spinner: spinners.bouncingBall });
start();
setTimeout(() => stop(), 3000);
```
Where `spinner` can be a object with `frames` (an array of strings) and `interval` (a number) property.
The library [cli-spinners](https://www.npmjs.com/package/cli-spinners) already provide several spinners in this format.
### Options
| Option | Description | Default Value |
| ---------- | -------------------------------------------------------------------------------------------- | ---------------------------------------- |
| spinner | Custom Spinner to use | **dots** from the `cli-spinners` library |
| clearOnEnd | Specifies if the loading line on the console must be cleared on calling the `stop` function. | true |
### License
MIT