Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@fedlinker/progress

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@fedlinker/progress

Progress bar for Node.js with nuxt/webpackbar style

  • 0.1.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
Maintainers
1
Weekly downloads
 
Created
Source

@fedlinker/progress

Progress bar for Node.js with nuxt/webpackbar style.

webpackbar

Install

npm i -S @fedlinker/progress

Usage

const Progress = require('@fedlinker/progress')

let value = 0
let total = 100

const progress = new Progress({
  total,
  value,
  head: 'client',
  title: 'building modules (:percent)',
  subtitle: ':value/:total modules (:time)',
  description: 'node_modules/@fedlinker/progress/example.js'
})

progress.start()

let timer = setTimeout(update, 100)

function update () {
  value += 1
  progress.update(value)

  if (value < total) {
    timer = setTimeout(update, 100)
  } else {
    progress.stop('Done! Time: :time')
    clearTimeout(timer)
  }
}

The :value, :total, :percent and :time above are placeholder tokens, they will be replaced with runtime values.

Options

  • stream: Writable stream, defualt is process.stderr. It must be a TTY.
  • width: The width of progress bar, default is 25.
  • total: Total value, default is 1.
  • value: Value, default is 0.
  • color: Theme color. It could be a hex color or a normal color string.
  • head: Head string.
  • title: Title string.
  • subtitle: Subtitle string.
  • description: Description string.

Tokens

You can use tokens in head, title, subtitle and description. The tokens will be replaced with their runtime values.

These are tokens you can use:

  • :value: The value option.
  • :total: The total option.
  • :percent: Percentage of value / total.
  • :time: Spent time in processing.

Methods

  • .start(): Start progress.
  • .update(value | options): Update the progress bar.
  • .stop(string): Stop progress. The param string will be displayed in ternimal eventually, it also accepts tokens.

License

MIT.

Keywords

FAQs

Package last updated on 12 Nov 2018

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc