cli-meter
meter = require 'cli-meter'
Creating a meter
# 100 steps by default m = # optional total steps m = total: 500 # optional starting value m = total: 500value: 120 # optional display length in the terminal m = total: 500length: 30
You can then manipulate it with
mstep1 # increment by 1 mstep-3 # decrement by 3 mset70 # jump to 70
And finally display it
consolelog "Processing "# Processing [============== ] consolelog " dB"# [============== ] 30 dB consolelog " / "# [============== ] 230 / 500
Animations
If you use console.log
, the meter will be printed to a different line each time:
# [============ ] 6 / 10 # [================ ] 8 / 10
If you have a TTY
stream like process.stdout
, you can show animations instead:
setInterval -> processstdoutwrite "Meter 1 \n" processstdoutwrite "Meter 2 \n" processstdoutwrite "Meter 3 \n" processstdoutmoveCursor 0-3 100