JSPM

progress-of

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q37834F

Get progress & ETA of iterables

Package Exports

  • progress-of
  • progress-of/index.js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (progress-of) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

progress-of

Get progress and ETA of an iterator.

  • Pretty, human-readable percentages and time estimates
  • Gives you the data to print, doesn't log itself – cross-platform

Install

npm install progress-of

Example

import progressOf from 'progress-of'

for await(const [item, p] of progressOf([1, 2, 3])) {
  console.log(p.message) // 10% [1/10] ETA: 1m Elapsed: 10s
  console.log(`${p.percentPretty} [${p.counter}/${p.total}] ETA: ${p.etaPretty} Elapsed: ${p.elapsedPretty}`)
}

API

for(const [, progress] of progressOf(iterable, opts)) {}
  • iterable [Iterable] Iterable to iterate over
  • opts.size [number=iterable.length|Infinity] Iterable's size
  • progress.eta [string] Human readable current ETA (between 0 & ∞)
  • progress.elapsed [string] Human readable time elapsed since start
  • progress.percent [string] Human readable current percentage done
  • progress.message [string] Human readable message, like: 10% [1/10] ETA: 1m Elapsed: 10s
  • progress.etaValue [number] ETA (in ms)
  • progress.elapsedValue [number] Elapsed time (in ms)
  • progress.percentValue [number] Percent value (between 0 & 100)
  • progress.ratio [number] Fraction of items done (between 0 & 1)
  • progress.current [number] Current counter of the iterable
  • progress.total [number] Total size of the iterable

Libraries Used