1.0.8 • Published 10 years ago
lapse v1.0.8
lapse
command-line progress bar

install
$ npm install lapseexamples
$ node -e "require('repl').start({ignoreUndefined: true})" # repl formatting> var lapse = require('lapse')
> lapse( 60 )
|⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 60.0
> lapse( 60, { format: " #mtime [#bar] #percent% #secondss " } )
00:47 [⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅|⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅] 100.0% 15.0s
> lapse( 60, { car_char: "✂ ", road_char: "-" } )
-------------------------✂ ------------------------- 30.0
> lapse( 600, { car_char: "\u001b[36m☂ \u001b[0m" } )
⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅☂ ⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 2:30
> lapse( 60, { trail: true } )
|||||||||||||||||||||||||||⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅⋅ 30.0 use
press space to pause/play
options
streamstream- the output stream
- defaults to
process.stderr
widthint- the width of the lapse bar and stats
- defaults to terminal-width (
process.stderr.columns)
car_charstring- the character that travels across the lapse bar
- defaults to
|
road_charstring- the character that is used everywhere around the
car_char - defaults to
⋅
- the character that is used everywhere around the
trailbool- creates a repeated trail behind the
car_char - defaults to
false
- creates a repeated trail behind the
clearbool- clears the bar upon completion
- defaults to
false
callbackfunction- function to execute upon completion
refresh_rateint- the refresh rate of the lapse line
* occurs every
1000 / refresh_ratemilliseconds - defaults to
100
- the refresh rate of the lapse line
* occurs every
formatstring- lapse line formatting:
tagsare replaced by dynamic values#bardisplays the bar animation#percentdisplays completion percentage#etadisplays a formatted time to completion#secondsdisplays number of elapsed seconds#elapseddisplays formatted elapsed time#timedisplays current 12-hour time#mtimedisplays current 24-hour time#startdisplays start time as 12-hour *#mstartdisplays start time as 24-hour - defaults to
#bar #eta
- lapse line formatting:
acknowledgements
- thanks to @tj for making node-progress