https://github.com/kevin940726/nyan-progress
Nyan cat progress bar in Node, why not?
https://github.com/kevin940726/nyan-progress
loader node nyan nyan-cat progress
Last synced: about 1 month ago
JSON representation
Nyan cat progress bar in Node, why not?
- Host: GitHub
- URL: https://github.com/kevin940726/nyan-progress
- Owner: kevin940726
- License: mit
- Created: 2017-01-17T14:33:43.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-03-12T09:11:29.000Z (over 8 years ago)
- Last Synced: 2025-08-30T10:36:09.552Z (about 1 month ago)
- Topics: loader, node, nyan, nyan-cat, progress
- Language: JavaScript
- Homepage: https://www.npmjs.com/package/nyan-progress
- Size: 209 KB
- Stars: 46
- Watchers: 1
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# nyan-progress
A nyan cat progress bar for Node.
[](https://badge.fury.io/js/nyan-progress)[](https://nodei.co/npm/nyan-progress/)

---
## Installation
```bash
yarn add nyan-progress
```
or if you use npm instead,
```bash
npm install --save nyan-progress
```## Usage
```js
import nyanProgress from 'nyan-progress';
// OR
// const nyanProgress = require('nyan-progress);const progress = nyanProgress(); // initialize
progress.start({ total: 100 }); // start the progressconst timer = setInterval(() => {
progress.tick();if (progress.isComplete) {
clearInterval(timer);
}
}, 100);
```The above example will produce the result shown in the gif in the begining.
### options
The `start()` function can pass in an option object, the available options are listed below.- curr: the start point of the progress. Default: `0`.
- total: the end point of the progress. Default: `100`.
- width: the length of the progress bar. Default: `20`.
- renderThrottle: the interval that the progress update, in milliseconds. Default: `500`.
- message: an object containing the message to show in the progress.
- downloading: a list of frames to show when downloading. Default: `['Nyaning. ', 'Nyaning.. ', 'Nyaning...']`.
- finished: a string to show when the progress is completed. Default: `'Nyaned'`.
- error: a string to show when the progress is interupted. Default: `'Something nyan wrong...'`.
- callback: callback function to do when completed.You can also pass the callback function as second argument of the `start()` function.
```js
progress.start({}, callback);
```The `start()` function also return a promise.
```js
progress.start().then(callback);
```### API
##### `start(options, callback?)`
The function to nyan the cat.##### `tick(value? = 1)`
The function that increment `curr` by `value`, `value` is default to 1 if not specified. When `curr` reached to `total`, the progress will stop.##### `interupt()`
For whatever reason you want to interupt the nyaning, call it. Note that it would not throw any error but display error message in the progress itself.## License
MIT## Credits
- [visionmedia/node-progress](https://github.com/visionmedia/node-progress): for inspiring the api and usage.
- [milkandsour/nyanloader](https://github.com/milkandsour/nyanloader): for the awesome simple but cute enough nyan cat text.