{"id":13892467,"url":"https://github.com/vitonsky/arrival-time","last_synced_at":"2025-07-05T02:35:02.530Z","repository":{"id":251553912,"uuid":"837735507","full_name":"vitonsky/arrival-time","owner":"vitonsky","description":"Simple and powerful progress time estimation (ETA) for JavaScript","archived":false,"fork":false,"pushed_at":"2024-12-17T05:26:36.000Z","size":811,"stargazers_count":115,"open_issues_count":5,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-24T20:03:05.712Z","etag":null,"topics":["backend","cli","estimate","estimation","eta","frontend","nodejs","progress","progress-bar"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/arrival-time","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/vitonsky.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-08-03T21:38:50.000Z","updated_at":"2025-02-08T23:34:16.000Z","dependencies_parsed_at":"2024-11-07T06:31:13.335Z","dependency_job_id":"f0e4f752-8fb8-4303-95f7-f0fe561cc075","html_url":"https://github.com/vitonsky/arrival-time","commit_stats":null,"previous_names":["vitonsky/arrival-time"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/vitonsky/arrival-time","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitonsky%2Farrival-time","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitonsky%2Farrival-time/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitonsky%2Farrival-time/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitonsky%2Farrival-time/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vitonsky","download_url":"https://codeload.github.com/vitonsky/arrival-time/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vitonsky%2Farrival-time/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":263671808,"owners_count":23494043,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["backend","cli","estimate","estimation","eta","frontend","nodejs","progress","progress-bar"],"created_at":"2024-08-06T17:00:58.439Z","updated_at":"2025-07-05T02:35:02.513Z","avatar_url":"https://github.com/vitonsky.png","language":"TypeScript","funding_links":[],"categories":["TypeScript"],"sub_categories":[],"readme":"Simple and powerful time estimation (ETA).\n\nIdeal to draw progress in CLI, web and mobile.\n\n- Zero dependencies. Works everywhere - node, browsers, toaster, etc.\n- ETA, speed measurements and average step time estimation\n\n![](./docs/eta.gif)\n\n# Usage\n\nInstall with `npm i arrival-time` or `yarn add arrival-time`\n\n```js\nimport { Estimation } from 'arrival-time';\n\nconst estimation = new Estimation();\n\n// Update progress to 25 of 100, and get measurements\nconst measure1 = estimation.update(25, 100);\nconsole.log(\"Estimated time\", measure1.estimate); // Estimated time 0.11754299999961404\nconsole.log(\"Estimated speed\", measure1.speed); // Estimated speed 638064.3679355322\n\nconsole.log(measure1);\n// {\n// \ttimeDelta: 0.039180999999871347,\n// \taverageTime: 0.0015672399999948539,\n// \tprogressLeft: 75,\n// \tspeed: 638064.3679355322,\n// \testimate: 0.11754299999961404\n// }\n\nconsole.log(estimation.update(50, 100))\n// {\n// \ttimeDelta: 12.311336999999867,\n// \taverageTime: 0.24622673999999733,\n// \tprogressLeft: 50,\n// \tspeed: 4061.297322947178,\n// \testimate: 12.311336999999867\n// }\n```\n\n# API\n\n### constructor\n\n```ts\ntype Options = {\n\t// Current progress (default 0)\n\tprogress?: number;\n\t// Total progress (default 100)\n\ttotal?: number;\n\t// Time to start count from (default - current time)\n\tstartTime?: number;\n\t// Optionally, you may provide your own clock implementation,\n\t// that will return time as number\n\ttimeFetcher?: TimeFetcher;\n};\n```\n\n### update(progress: number, total?: number)\n\nUpdate current progress, and optionally update total progress.\n\nReturns updated object with measurements.\n\n### measure(tick = 1000)\n\nReturn measurements object\n\n```ts\ntype Measurements = {\n\t/**\n\t * Time delta between start time and current time\n\t */\n\ttimeDelta: number;\n\t/**\n\t * Average time per one progress step\n\t */\n\taverageTime: number;\n\t/**\n\t * Left progress\n\t */\n\tprogressLeft: number;\n\t/**\n\t * Progression per `tick` (default 1000ms)\n\t */\n\tspeed: number;\n\t/**\n\t * Estimated time in ms until complete\n\t */\n\testimate: number;\n};\n```\n\n### estimate()\n\nReturn `estimate` value\n\n### reset(time?: number)\n\nReset start time to provided or current time\n\n### now()\n\nReturn current timestamp\n\n# Related projects\n\n- [humanize-duration](https://www.npmjs.com/package/humanize-duration) - converts time in ms to human readable time\n- [log-update](https://www.npmjs.com/package/log-update) - print and redraw messages to stdout\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitonsky%2Farrival-time","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvitonsky%2Farrival-time","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvitonsky%2Farrival-time/lists"}