Skip to content

isaacs/char-spinner

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

11 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

char-spinner

Put a little spinner on process.stderr, as unobtrusively as possible.

USAGE

var spinner = require("char-spinner")

// All options are optional
// even the options argument itself is optional
var interval = spinner(options)

// the return value is the interval.
// to stop the spinner, you can just clearInterval on it
clearInterval(interval)

// then to restart it again, just call the function again
interval = spinner(options)

OPTIONS

Usually the defaults are what you want. Mostly they're just configurable for testing purposes.

  • stream Output stream. Default=process.stderr
  • tty Only show spinner if output stream has a truish .isTTY. Default=true
  • string String of chars to spin. Default='/-\\|'
  • interval Number of ms between frames, bigger = slower. Default=50
  • cleanup Print '\r \r' to stream on process exit. Default=true
  • unref Unreference the spinner interval so that the process can exit normally. Default=true
  • delay Number of frames to "skip over" before printing the spinner. Useful if you want to avoid showing the spinner for very fast actions. Default=2

Returns the generated interval, if one was created.

About

Put a little spinner on process.stderr, as unobtrusively as possible.

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published