@bnmkt/progress

0.0.1 • Public • Published

@bnmkt/ProgressBar

Custom progress bar using Fira Code

Installation

    npm i -D @bnmkt/progressbar

Usage

Example usage

    import {progress} from "@bkt/progress"
    const clearLastLine = () => {
        process.stdout.clearLine()
        process.stdout.cursorTo(0)
    }
    
    // Using the progress bar
    progress.setValue(0) // Set the default value
            .setMax(1000) // Set Maximum value
            .setSize(15) // Size in character
    
    const interval = setInterval(() => {
        clearLastLine()
        const max = progress.getMax()
        const current = progress.getValue()
    
        if(current >= max){
            clearInterval(interval)
            process.stdout.write(`${progress.show()}\nProgressBar finished\n`)
            process.exit()
        }
    
        process.stdout.write(`${progress.show()} ${current}/${max}`)
        progress.add(50) 
    
    }, 100)

Simulating a progress bar

    import {progress} from "@bkt/progress"
    // Simulating a progress bar
    progress.simulate()

Requirements

Package Sidebar

Install

npm i @bnmkt/progress

Weekly Downloads

4

Version

0.0.1

License

ISC

Unpacked Size

48.5 kB

Total Files

7

Last publish

Collaborators

  • bnmkt