- Notifications
You must be signed in to change notification settings - Fork1
Library for creating highly customizable CLI-like progress bars in javascript
License
NathanPB/progress.js
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
Simple highly customized CLI-like progress bar for Javascript
If you get any questions or suggestions just open adiscussion or anissue
This package is published innpmjs:
npm i @nathanpb/progress
oryarn add @nathanpb/progress
If you want to try the unstable features, use thenext
tag:npm i @nathanpb/progress@next
.
import{initSimpleBar,ProgressBar,Tokens}from'@nathanpb/progress'constbar=newProgressBar({total:100})initSimpleBar({ bar,template:'[$bar$] $progress$% | eta $eta$ s | elapsed $elapsed$ s',stream:process.stdout,tokens:{bar:Tokens.bar({length:30}),eta:Tokens.eta({interval:1000}),elapsed:Tokens.elapsedTime({interval:1000}),progress:Tokens.progress({decimalDigits:2})}})bar.on(Events.COMPLETED,()=>console.log('Bar completed'))setInterval(()=>bar.tick(1),500)
You can also group multiple progress bars:
initMultiBar({bars:[bar1,bar2,bar3],template:'$title$ [$bar$] $progress$% | eta $eta$ s | elapsed $elapsed$ s',tokens:{bar:Tokens.bar({length:30}),eta:Tokens.eta({interval:1000}),elapsed:Tokens.elapsedTime({interval:1000}),progress:Tokens.progress({decimalDigits:2}),title:Tokens.title()},stream:process.stdout})
The above code is a shortcut to the full version.If you want to take control over the customization, check theUnder the Hood page.
Also, check theexamples page.
Compared to other similar libraries (special thanks tonode-progress which was my inspiration), this lib is a bitovercomplicated. So if you want something dead simple, their solution might suit better for your use case.
Copyright 2021 Nathan P. BombanaPermission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
Do whatever you want with my code just don't make it boring
About
Library for creating highly customizable CLI-like progress bars in javascript
Topics
Resources
License
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Uh oh!
There was an error while loading.Please reload this page.
Contributors2
Uh oh!
There was an error while loading.Please reload this page.