npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

progress-info

v1.0.4

Published

determine long running progress status.

Downloads

13

Readme

progress-info NPM version Build Status Dependency Status Donate Coverage Status

determine long running progress status.

Installation

npm install --save progress-info

Usage

Asuming we want to process 100 documents and define a checkpoint size of10\.

const ProgressInfo = require('progress-info');

var total = 100
var checkpointSize = 10
var progressInfo = new ProgressInfo(total, checkpointSize);
var index = 0;

var interval = setInterval(function () {
    index++
    if (index % checkpointSize === 0){
     	console.log(progressInfo.info(index))
        progressInfo.checkpoint();
        if (index === total){
            clearInterval(interval)
            done()
        }
    }
}, 50)

Yields:

checkpoint: 17:02:48 (10.00%)   T -5.32 seconds (t 0.59 seconds/10 docs)        D -90 (10/100)
checkpoint: 17:02:48 (20.00%)   T -4.63 seconds (t 0.58 seconds/10 docs)        D -80 (20/100)
checkpoint: 17:02:49 (30.00%)   T -4.00 seconds (t 0.57 seconds/10 docs)        D -70 (30/100)
checkpoint: 17:02:49 (40.00%)   T -3.46 seconds (t 0.58 seconds/10 docs)        D -60 (40/100)
checkpoint: 17:02:50 (50.00%)   T -2.80 seconds (t 0.56 seconds/10 docs)        D -50 (50/100)
checkpoint: 17:02:51 (60.00%)   T -2.26 seconds (t 0.56 seconds/10 docs)        D -40 (60/100)
checkpoint: 17:02:51 (70.00%)   T -1.73 seconds (t 0.58 seconds/10 docs)        D -30 (70/100)
checkpoint: 17:02:52 (80.00%)   T -1.13 seconds (t 0.56 seconds/10 docs)        D -20 (80/100)
checkpoint: 17:02:52 (90.00%)   T -0.57 seconds (t 0.57 seconds/10 docs)        D -10 (90/100)
checkpoint: 17:02:53 (100.00%)  T -0.00 seconds (t 0.56 seconds/10 docs)        D -0 (100/100)

API

Constructor

ProgressInfo(documentsTotal, checkpointSize)

Methods

  • ProgressInfo.rawTimeString(milliseconds) returns a time in seconds as human readble string.
  • ProgressInfo.estimatedTime(documentIndex) returns an estimated time in seconds as human readble string.
  • ProgressInfo.percent(documentIndex) returns an percent value as decimal.
  • ProgressInfo.index(documentIndex) returns an string in form of [current document] / [total documents].
  • ProgressInfo.docsLeft(documentIndex) returns a counter integer of forthcoming documents.
  • ProgressInfo.checkpoint() resets the current time for the next measurement.
  • ProgressInfo.time() returns a short time string of current time.
  • ProgressInfo.tx() returns a short time string of past time.
  • ProgressInfo.info(documentIndex) returns a full information string of current progress like in the usage example above.

License

MIT © Stephan Ahlf