Skip to content

Latest commit

 

History

6 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

gofreddo

Calcutates estimated time remaining(ETA) estimated finish time and percent complete for large processes.

Install

Install with npm

$ npm i @gofreddo/eta --save

Usage

  const Eta = require('@gofreddo/eta');
  const eta = new Eta({
    total: 10,
  });

  eta.on('tick', (result) => {
    console.log(`tick = ${JSON.stringify(result, null, 2)}`);
  });
  eta.on('finished', (result) => {
    console.log(`finished = ${JSON.stringify(result, null, 2)}`);
  });

  const handle = setInterval(() => {
    const result = eta.tick();
    console.log(JSON.stringify(result, null, 2));
    if (eta.count === 10) {
      clearInterval(handle);
    }
  }, 1000);
tick = {
  "startTime": "2017-01-30T00:10:48.387Z",
  "eta": "2017-01-30T00:10:58.437Z",
  "secondsRemaining": 0,
  "percentComplete": 1,
  "count": 10,
  "total": 10,
  "timeTo": "a few seconds ago",
  "finishedAt": "2017-01-30T00:10:58.437Z"
}
finished = {
  "startTime": "2017-01-30T00:10:48.387Z",
  "eta": "2017-01-30T00:10:58.437Z",
  "secondsRemaining": 0,
  "percentComplete": 1,
  "count": 10,
  "total": 10,
  "timeTo": "a few seconds ago",
  "finishedAt": "2017-01-30T00:10:58.437Z"
}

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jeff Wilde

License

Copyright © 2017 [Jeff Wilde](#Jeff Wilde) Licensed under the MIT license.


This file was generated by readme-generator on January 29, 2017.

About

Calcutates estimated time remaining(ETA) estimated finish time and percent complete for large processes.

Resources

Stars

2 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages