{"_id":"arrival-time","_rev":"7-0515b0cb65359e0def189b5bbdf03491","name":"arrival-time","dist-tags":{"latest":"1.0.6"},"versions":{"0.0.1":{"name":"arrival-time","version":"0.0.1","_id":"arrival-time@0.0.1","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"dist":{"shasum":"bee3380bb1fdefad35286d976cb20092705afbbd","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-0.0.1.tgz","fileCount":4,"integrity":"sha512-ShUjazp4nnkzltXBWinK8tOEMnyjqaptzdN+Q0aP9XCXY7CJx5lM5TgpPhzn+PFZ3P/22jjvHllRd6b7JpHI5Q==","signatures":[{"sig":"MEUCIQDovPMkGtFlZRql02wLX0zMIJ/XyPenLUqLyCHrE5fYJgIgbLzP/ret3L7LqmvonoN0APinVdk6x25k9jRfS8aGTI4=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":2653},"main":"index.js","gitHead":"fd74c9444a6eafacc12099817ab002b4b45c2bc7","_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"_npmVersion":"10.7.0","description":"Short one paragraph description, which answer to question \"what is this?\".","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arrival-time_0.0.1_1722725902459_0.917178702660524","host":"s3://npm-registry-packages"}},"1.0.0":{"name":"arrival-time","version":"1.0.0","keywords":["eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"license":"MIT","_id":"arrival-time@1.0.0","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"homepage":"https://github.com/vitonsky/arrival-time","bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"dist":{"shasum":"4da793669eac61301ddcd9b19288651e388d2429","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-1.0.0.tgz","fileCount":4,"integrity":"sha512-qEkp8PtBjN9naPZv72Hl68LCd3GQfhbbl1AiQn1j7pCVZK9tGuWaQGqOwDYQ5Uu/2UIUTFjXZP9BB8jZUoFwFQ==","signatures":[{"sig":"MEYCIQDgiDWcAK/koy15ZQuhY7Z1MltG1ge4voQ6enYPIWi7iQIhAIMkMuExv6qpLQsj2K7BNYGjFf1GZIclwEuux6IorTF8","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4713},"main":"index.js","gitHead":"75f66c7676bde3f4b37fdda93427f1fca91da3ae","_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"repository":{"url":"git+https://github.com/vitonsky/arrival-time.git","type":"git"},"_npmVersion":"10.7.0","description":"Simple and powerful progress time estimation (ETA)","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arrival-time_1.0.0_1722728322991_0.04996570863009819","host":"s3://npm-registry-packages"}},"1.0.1":{"name":"arrival-time","version":"1.0.1","keywords":["backend","frontend","CLI","web","node","eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"license":"MIT","_id":"arrival-time@1.0.1","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"homepage":"https://github.com/vitonsky/arrival-time","bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"dist":{"shasum":"cadca5e6a48ddf95c16878663211c5008ab1bfa6","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-1.0.1.tgz","fileCount":4,"integrity":"sha512-3ZZRVTZZ8/XAyw7U285NXQG5+LaGE4U9B6aQ2kxB4rp1aQwhH8bF9k1LkYJY2Ancbn+Ul5oS7nmbeyUaOBjo/g==","signatures":[{"sig":"MEUCIGwa1q81M7mchrAu/zYmNYpCEmFoQU8/nnrTC8o5AfNoAiEAykoE9vBAHQz3hFsb6359n9jM/F80m+jCN1sG+zyqCVw=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":4896},"main":"index.js","gitHead":"0e60d6fbe779f27ef798d69762a67471f3001a6b","_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"repository":{"url":"git+https://github.com/vitonsky/arrival-time.git","type":"git"},"_npmVersion":"10.7.0","description":"Simple and powerful progress time estimation (ETA)","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arrival-time_1.0.1_1722728761940_0.22420739211250895","host":"s3://npm-registry-packages"}},"1.0.2":{"name":"arrival-time","version":"1.0.2","keywords":["backend","frontend","CLI","web","node","eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"license":"MIT","_id":"arrival-time@1.0.2","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"homepage":"https://github.com/vitonsky/arrival-time","bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"dist":{"shasum":"52c2b56c1db49ffc986432862146ccbaf7efb2b7","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-1.0.2.tgz","fileCount":4,"integrity":"sha512-mbULK4Qd7VYoEg0mxQNFP8EanMBz7Gf1oxnSSf387APMeyecZEV7wR+wsdSwcQ36P3TYwkLinlkunP4H79RtYg==","signatures":[{"sig":"MEUCIQDMiyv86EnTBZHN0XGz6aEOyr+wiCtMYviXTZVx9ydWlgIgNQfX2dOVCgPuNlER6Z+DSnzzzwk0CYo73cjHmR8zFTs=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5060},"main":"index.js","gitHead":"a5fcffab3dc653a4c28dc5522f8375ce07af73a7","_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"repository":{"url":"git+https://github.com/vitonsky/arrival-time.git","type":"git"},"_npmVersion":"10.7.0","description":"Simple and powerful progress time estimation (ETA)","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arrival-time_1.0.2_1722729426848_0.1477765134723532","host":"s3://npm-registry-packages"}},"1.0.3":{"name":"arrival-time","version":"1.0.3","keywords":["backend","frontend","CLI","web","node","eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"license":"MIT","_id":"arrival-time@1.0.3","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"homepage":"https://github.com/vitonsky/arrival-time","bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"dist":{"shasum":"df9af349f6c3c18481b1bb46c95e36c057d7fd12","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-1.0.3.tgz","fileCount":6,"integrity":"sha512-vAut3uVAp4hLDCechcOTKnUB4JYYd8Or5gcc6cTm6MgtiNkEDKjwb0ZWexH9W7CpH9GN5H5+c4qP5OqnEVGtQg==","signatures":[{"sig":"MEUCIQDdL4ogX9b105wPAO22e6MrtmzCQIALpbobt2l86dz+UwIgclxGGGUwR68XUyhBmVnAIL3208C23ggOMWOm42Byh8A=","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5886},"main":"index.js","gitHead":"aa629bd6688c6e1537519e534e89874c3ff1a9f8","_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"repository":{"url":"git+https://github.com/vitonsky/arrival-time.git","type":"git"},"_npmVersion":"10.7.0","description":"Simple and powerful progress time estimation (ETA)","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arrival-time_1.0.3_1722730736037_0.526272950314143","host":"s3://npm-registry-packages"}},"1.0.4":{"name":"arrival-time","version":"1.0.4","keywords":["backend","frontend","CLI","web","node","eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"license":"MIT","_id":"arrival-time@1.0.4","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"homepage":"https://github.com/vitonsky/arrival-time","bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"dist":{"shasum":"dad28d5bd45a53fff4f35ddb585f284455361c2a","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-1.0.4.tgz","fileCount":5,"integrity":"sha512-fFBjtMBNG5MUOG3nX89SfmDdOX4whs++pGecglVaq062KYGh5RZ0D61AG9w5i+63tkjWZA3t5XRERScgOQCcaA==","signatures":[{"sig":"MEQCIDfXG/N8AdSdn9kb8SpWqcCP21IY9KgU8SFL3jgVymrzAiAO+fLbrXpRsGEuyePofjf+DGTuPJuGAxlh6bw4eLI85g==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":9899},"types":"./index.d.ts","gitHead":"16257f6fe2c73b44a50bf53fbb38fa92ea94c4d5","_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"repository":{"url":"git+https://github.com/vitonsky/arrival-time.git","type":"git"},"_npmVersion":"10.7.0","description":"Simple and powerful progress time estimation (ETA)","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arrival-time_1.0.4_1722732004117_0.22867741107615736","host":"s3://npm-registry-packages"}},"1.0.5":{"name":"arrival-time","version":"1.0.5","keywords":["backend","frontend","CLI","web","node","eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"license":"MIT","_id":"arrival-time@1.0.5","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"homepage":"https://github.com/vitonsky/arrival-time","bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"dist":{"shasum":"188665727c60225c9bef40689a3fad642a959d4c","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-1.0.5.tgz","fileCount":6,"integrity":"sha512-7FeDH6MUJaPm9lWL+ajWjVLJr/pkw35ZiE2EBkuthzKdMPIG9ykJc8ov5W16uOePRBghZ9QLSBv8Q5twGjWJJA==","signatures":[{"sig":"MEYCIQD0/rL6Z/C9dH27pYcmXGo1D7A+wM//ltdFYNX1i4gS2wIhAINQYnXDa5+5ssIaDknR2dsT1+0U+sTGBVoB5d3KSNc+","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":144923},"types":"./index.d.ts","gitHead":"0f691e441e4568cee4ec253be61c0d379a69a7aa","_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"repository":{"url":"git+https://github.com/vitonsky/arrival-time.git","type":"git"},"_npmVersion":"10.7.0","description":"Simple and powerful progress time estimation (ETA)","directories":{},"_nodeVersion":"20.15.1","_hasShrinkwrap":false,"_npmOperationalInternal":{"tmp":"tmp/arrival-time_1.0.5_1722772463943_0.4915877454551789","host":"s3://npm-registry-packages"}},"1.0.6":{"name":"arrival-time","version":"1.0.6","description":"Simple and powerful progress time estimation (ETA)","keywords":["backend","frontend","CLI","web","node","eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"license":"MIT","author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"homepage":"https://github.com/vitonsky/arrival-time","repository":{"type":"git","url":"git+https://github.com/vitonsky/arrival-time.git"},"_id":"arrival-time@1.0.6","gitHead":"e8f278cf0f0deca27b64ba2453e4495efb631b04","types":"./index.d.ts","bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"_nodeVersion":"20.15.1","_npmVersion":"10.7.0","dist":{"integrity":"sha512-iWdmcH/sGHt2z8On3QWqj55vh7NBnx9AEvrK99m84Eyik4+30g50+ZlcszwAT8541eDwvkDBTy8CgDHEYBtetw==","shasum":"6b7012c756801551126859029e744e69fbe3d735","tarball":"https://registry.npmjs.org/arrival-time/-/arrival-time-1.0.6.tgz","fileCount":6,"unpackedSize":145973,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIBJj8wyLP04ORbbvFn/Qk4/MrcCOuoYLLbSa3vVwxqnWAiB0n6PF+F/TK4dgAdjtlZdkrSJFFRrqTLGCHJ7fzCa55w=="}]},"_npmUser":{"name":"vitonsky","email":"robvitonsky@protonmail.com"},"directories":{},"maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/arrival-time_1.0.6_1722857663524_0.3336132613770193"},"_hasShrinkwrap":false}},"time":{"created":"2024-08-03T22:58:22.458Z","modified":"2024-08-05T11:34:23.846Z","0.0.1":"2024-08-03T22:58:22.611Z","1.0.0":"2024-08-03T23:38:43.129Z","1.0.1":"2024-08-03T23:46:02.057Z","1.0.2":"2024-08-03T23:57:06.994Z","1.0.3":"2024-08-04T00:18:56.252Z","1.0.4":"2024-08-04T00:40:04.321Z","1.0.5":"2024-08-04T11:54:24.089Z","1.0.6":"2024-08-05T11:34:23.678Z"},"bugs":{"url":"https://github.com/vitonsky/arrival-time/issues"},"author":{"name":"Robert Vitonsky","email":"https://github.com/vitonsky"},"license":"MIT","homepage":"https://github.com/vitonsky/arrival-time","keywords":["backend","frontend","CLI","web","node","eta","estimate","estimated","time","estimated time","estimated-time","progress","progress eta","progress-eta"],"repository":{"type":"git","url":"git+https://github.com/vitonsky/arrival-time.git"},"description":"Simple and powerful progress time estimation (ETA)","maintainers":[{"name":"vitonsky","email":"robvitonsky@protonmail.com"}],"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","readmeFilename":"README.md"}