{"id":13452033,"url":"https://github.com/bvaughn/progress-estimator","last_synced_at":"2025-04-10T23:27:09.933Z","repository":{"id":33505111,"uuid":"158973276","full_name":"bvaughn/progress-estimator","owner":"bvaughn","description":"Logs a progress bar and estimation for how long a Promise will take to complete","archived":false,"fork":false,"pushed_at":"2023-04-17T19:08:07.000Z","size":142,"stargazers_count":2142,"open_issues_count":0,"forks_count":49,"subscribers_count":14,"default_branch":"master","last_synced_at":"2025-04-03T14:07:12.603Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bvaughn.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-11-24T21:01:38.000Z","updated_at":"2025-04-01T05:32:47.000Z","dependencies_parsed_at":"2022-08-07T22:00:25.739Z","dependency_job_id":"ef6b1768-7990-4446-b2f1-6cd97826a76a","html_url":"https://github.com/bvaughn/progress-estimator","commit_stats":{"total_commits":32,"total_committers":10,"mean_commits":3.2,"dds":0.5,"last_synced_commit":"ae368d4258c7ec46197809b57389d1c58ac0a737"},"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Fprogress-estimator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Fprogress-estimator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Fprogress-estimator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bvaughn%2Fprogress-estimator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bvaughn","download_url":"https://codeload.github.com/bvaughn/progress-estimator/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248313996,"owners_count":21082963,"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":[],"created_at":"2024-07-31T07:01:10.733Z","updated_at":"2025-04-10T23:27:09.912Z","avatar_url":"https://github.com/bvaughn.png","language":"JavaScript","readme":"# progress-estimator\n\nLogs a progress bar and estimation for how long a Promise will take to complete. This library tracks previous durations in order to provide more accurate estimates over time.\n\n![Demo](https://user-images.githubusercontent.com/29597/48986949-474e2400-f0cf-11e8-86d7-d201f8ad8eca.gif)\n\n### 🎉 [Become a sponsor](https://github.com/sponsors/bvaughn/) or ☕ [Buy me a coffee](http://givebrian.coffee/)\n\n## Installation\n\n```shell\n# use npm\nnpm install progress-estimator\n\n# use yarn\nyarn add progress-estimator\n```\n\n## Usage example\n\n```js\nconst createLogger = require('progress-estimator');\nconst { join } = require('path');\n\n// All configuration keys are optional, but it's recommended to specify a storage location.\n// Learn more about configuration options below.\nconst logger = createLogger({\n  storagePath: join(__dirname, '.progress-estimator'),\n});\n\nasync function run() {\n  await logger(promiseOne, \"This is a promise\");\n  await logger(\n    promiseTwo,\n    \"This is another promise. I think it will take about 1 second\",\n    {\n      estimate: 1000\n    }\n  );\n}\n```\n## API\n\n### `createLogger(optionalConfiguration)`\n\nThis method is the default package export. It creates and configures a logger function (documented below). The following configuration options are supported. (They apply only to the logger instance that's returned.)\n\n| name | type | Description |\n| --- | --- | --- |\n| `logFunction` | Function | Custom logging function. Defaults to [`log-update`](https://npmjs.com/package/log-update). Must define `.done()` and `.clear()` methods. |\n| `spinner` | object | Which spinner from the [`cli-spinners`](https://npmjs.com/package/cli-spinners) package to use. Defaults to `dots`. |\n| `storagePath` | string | Where to record durations between runs. Defaults to [`os.tmpdir()`](https://nodejs.org/api/os.html). |\n| `theme` | object | Custom [`chalk`](https://npmjs.com/package/chalk) theme. Look to the [default theme](https://github.com/bvaughn/progress-estimator/blob/master/src/theme.js) for a list of required keys. |\n\n### `logger(promise, labelString, options)`\n\nThis method logs a progress bar and estimated duration for a promise. It requires at least two parameters– a `Promise` and a label (e.g. \"Running tests\"). The label is SHA1 hashed in order to uniquely identify the promise.\n\nAn optional third parameter can be provided as well with the following keys:\n\n| name | type | Description |\n| --- | --- | --- |\n| `estimate` | Number | Estimated duration of promise. (This value is used initially, until a history of actual durations have been recorded.) |\n| `id` | String | Uniquely identifies the promise. This value is needed if the label string is not guaranteed to be unique. |\n","funding_links":["https://github.com/sponsors/bvaughn/"],"categories":["JavaScript","Repository","CLI","CLI apps development","Node"],"sub_categories":["Command-line Utilities","Shell","命令行"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvaughn%2Fprogress-estimator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbvaughn%2Fprogress-estimator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbvaughn%2Fprogress-estimator/lists"}