Socket
Socket
Sign inDemoInstall

cli-spinner

Package Overview
Dependencies
0
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    cli-spinner

A simple spinner


Version published
Weekly downloads
395K
decreased by-5.82%
Maintainers
1
Install size
84.1 kB
Created
Weekly downloads
 

Readme

Source

node-spinner

A simple spinner for node cli.

NPM NPM


Installation

This package is available on npm as cli-spinner.

npm install cli-spinner

Example usage

var Spinner = require('cli-spinner').Spinner;

var spinner = new Spinner('processing.. %s');
spinner.setSpinnerString('|/-\\');
spinner.start();

APIs

var obj = new Spinner('processing.. %s')

var obj = new Spinner({
    text: 'processing.. %s',
    stream: process.stderr,
    onTick: function(msg){
        this.clearLine(this.stream);
        this.stream.write(msg);
    }
})

Create a new spinner object. The advanced options can be used in any combination, none of them are required.

obj.start()

Starts the spinner.

obj.stop(clean)

Stops the spinner. Accepts a Boolean parameter to clean the console.

obj.isSpinning()

Returns true/false depending on whether the spinner is currently spinning.

obj.setSpinnerString(spinnerString)

Sets the spinner string. Accepts either a String or an Integer index to reference the built-in spinners.

obj.setSpinnerDelay(spinnerDelay)

Sets the spinner animation speed.

obj.setSpinnerTitle(spinnerTitle)

Sets the spinner title. Use printf-style strings to position the spinner.

Spinner.setDefaultSpinnerString(spinnerString)

Sets the default spinner string for all newly created instances. Accepts either a String or an Integer index to reference the built-in spinners.

Spinner.setDefaultSpinnerDelay(spinnerDelay)

Sets the default spinner delay for all newly created instances.

Demo

To see a demonstration of the built-in spinners, point your console at the example folder and run:

node spinner.js

preview

Keywords

FAQs

Last updated on 01 Mar 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc