Giter Club home page Giter Club logo

node-spinner's Introduction

node-spinner

A simple spinner for node cli.

NPM NPM

gitcheese.com

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

node-spinner's People

Contributors

b3by avatar bojack-corgi avatar brutalchrist avatar bryant1410 avatar brycekahle avatar helloiampau avatar janslow avatar nnnnathann avatar pierrefourgeaud avatar piranna avatar rickycodes avatar shennan avatar sixcircuit avatar w1ndy avatar ythecombinator avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.