API

animationCallback#

If the value returned is falsy, the animation will stop playing

Type: Function

Parameters#

Returns boolean

animation#

Play an animation asynchronously

Parameters#

  • frames array<string> Array of frames to play
  • intervalTime number How many milliseconds each frame should be shown for (optional, default 1)
  • callback animationCallback Function to run after the current frame is shown (optional, default ()=>true)
  • clear boolean Clear the animation after it's done playing (optional, default false)

Returns number

clear#

Clear the console

count#

Log the number of times the label has been counted

Parameters#

  • label string (optional, default 'default')

Returns number

cursor#

Cursor control

hide#

Hide the cursor

show#

Show the cursor

isHidden#

Check if the cursor is hidden

Returns boolean

toggle#

Toggle the cursor

debug#

Print a debugging message to the console

Parameters#

  • content ...string The content to be printed

Returns string

error#

Print an error to the console

Parameters#

  • content ...string The content to be shown as the error

Returns string

info#

Print an informational message to the console

Parameters#

json#

Pretty-print, highlight, and log some JSON to the console

Parameters#

  • json any Content to convert to JSON and log
  • indentation number How many spaces should be used for indentation (optional, default 2)

Returns string

log#

Log a string to the console

Parameters#

  • content ...string The content to log to the console

Returns string

newline#

Semantic way of printing a newline character to stdout

Parameters#

  • repeat number How many new lines should be printed (optional, default 1)

progress#

Print a progress bar

Parameters#

  • percentage number Progress bar percentage (optional, default 100)
  • character string Character used in progress bar (optional, default '\u2588')
  • columns number (optional, default process.stdout.columns)

Returns string

timestamp#

Log to the console with a timestamp

Parameters#

  • on boolean Truthy or falsy value that determines if the timestamp will be logged

Returns boolean