Gathering detailed insights and metrics for yocto-spinner
Gathering detailed insights and metrics for yocto-spinner
Gathering detailed insights and metrics for yocto-spinner
Gathering detailed insights and metrics for yocto-spinner
npm install yocto-spinner
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
190 Stars
4 Commits
1 Forks
1 Watching
1 Branches
1 Contributors
Updated on 26 Nov 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
61.7%
4,598
Compared to previous day
Last week
28.2%
21,957
Compared to previous week
Last month
52.7%
80,299
Compared to previous month
Last year
0%
142,107
Compared to previous year
1
3
Tiny terminal spinner
SIGINT
, SIGTERM
)Check out ora
for more features.
1npm install yocto-spinner
1import yoctoSpinner from 'yocto-spinner'; 2 3const spinner = yoctoSpinner({text: 'Loading…'}).start(); 4 5setTimeout(() => { 6 spinner.success('Success!'); 7}, 2000);
Creates a new spinner instance.
Type: object
Type: string
Default: ''
The text to display next to the spinner.
Type: object
Default:
Customize the spinner animation with a custom set of frames and interval.
1{ 2 frames: ['-', '\\', '|', '/'], 3 interval: 100, 4}
Pass in any spinner from cli-spinners
.
Type: string
Default: 'cyan'
Values: 'black' | 'red' | 'green' | 'yellow' | 'blue' | 'magenta' | 'cyan' | 'white' | 'gray'
The color of the spinner.
Type: stream.Writable
Default: process.stderr
The stream to which the spinner is written.
Starts the spinner.
Returns the instance.
Optionally, updates the text:
1spinner.start('Loading…');
Stops the spinner.
Returns the instance.
Optionally displays a final message.
1spinner.stop('Stopped.');
Stops the spinner and displays a success symbol with the message.
Returns the instance.
1spinner.success('Success!');
Stops the spinner and displays an error symbol with the message.
Returns the instance.
1spinner.error('Error!');
Stops the spinner and displays a warning symbol with the message.
Returns the instance.
1spinner.warning('Warning!');
Clears the spinner.
Returns the instance.
Stops the spinner and displays an info symbol with the message.
Returns the instance.
1spinner.info('Info.');
Change the text displayed next to the spinner.
1spinner.text = 'New text';
Change the spinner color.
Returns whether the spinner is currently spinning.
Use yoctocolors
:
1import yoctoSpinner from 'yocto-spinner'; 2import {red} from 'yoctocolors'; 3 4const spinner = yoctoSpinner({text: `Loading ${red('unicorns')}`}).start();
JavaScript is single-threaded, so any synchronous operations will block the spinner's animation. To avoid this, prefer using asynchronous operations.
ora
Ora offers more options, greater customizability, promise handling, and better Unicode detection. It’s a more mature and feature-rich package that handles more edge cases but comes with additional dependencies and a larger size. In contrast, this package is smaller, simpler, and optimized for minimal overhead, making it ideal for lightweight projects where dependency size is important. However, Ora is generally the better choice for most use cases.
No vulnerabilities found.
No security vulnerabilities found.