{"id":13764190,"url":"https://github.com/watson/progress-string","last_synced_at":"2025-07-25T22:36:52.769Z","repository":{"id":57331032,"uuid":"72994795","full_name":"watson/progress-string","owner":"watson","description":"Get a progress bar as a string","archived":false,"fork":false,"pushed_at":"2018-01-29T11:47:09.000Z","size":25,"stargazers_count":95,"open_issues_count":0,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-01-02T06:23:11.821Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/watson.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}},"created_at":"2016-11-06T14:08:21.000Z","updated_at":"2024-09-21T07:28:43.000Z","dependencies_parsed_at":"2022-09-16T17:41:40.213Z","dependency_job_id":null,"html_url":"https://github.com/watson/progress-string","commit_stats":null,"previous_names":[],"tags_count":7,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson%2Fprogress-string","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson%2Fprogress-string/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson%2Fprogress-string/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/watson%2Fprogress-string/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/watson","download_url":"https://codeload.github.com/watson/progress-string/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":232897216,"owners_count":18593522,"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-08-03T16:00:15.294Z","updated_at":"2025-01-07T14:53:35.523Z","avatar_url":"https://github.com/watson.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Animation"],"sub_categories":[],"readme":"# progress-string\n\nGenerate a CLI progress bar as a string that you can then output in any\nway you like.\n\n\u003cimg src=\"./example/example.svg\" width=\"1200\"\u003e\n\n[![Build status](https://travis-ci.org/watson/progress-string.svg?branch=master)](https://travis-ci.org/watson/progress-string)\n[![js-standard-style](https://img.shields.io/badge/code%20style-standard-brightgreen.svg?style=flat)](https://github.com/feross/standard)\n\n## Installation\n\n```\nnpm install progress-string --save\n```\n\n## Usage\n\n```js\nvar progress = require('progress-string')\nvar diff = require('ansi-diff-stream')()\n\nvar value = 0\nvar total = 42\nvar bar = progress({width: 50, total: total})\n\nsetInterval(function () {\n  diff.write(\n    'The progress of the program is:\\n' +\n    bar(++value)\n  )\n  if (value === total) process.exit()\n}, 250)\n\ndiff.pipe(process.stdout)\n```\n\n## API\n\n### `var bar = progress(options)`\n\nThis module exposes a function that takes a single `options` argument\nand retuns a bar function.\n\nThese are the options:\n\n- `total` - (integer) The max value of the progress bar\n- `width` - (integer, default: 42) The width of the progress bar in chars\n- `incomplete` - (string, default: `-`) The char used to indicate the\n  incomplete part of the progress bar\n- `complete` - (string, default: `=`) The char used to indicate the\n  completed part of the progress bar\n- `style` - (function, optional) See `options.style` below for details\n\n#### `options.style`\n\nYou can provide a custom styling function to style the progress bar\nreturned by the `bar` function.\n\nIt will be called with two arguments: `complete` and `incomplete`. Each\na string representing its part of the progress bar.\n\nWhatever the style function returns will be returned by the `bar`\nfunction.\n\n```js\nvar bar = progress({\n  width: 10,\n  total: 100,\n  style: function (complete, incomplete) {\n    // add an arrow at the head of the completed part\n    return complete + '\u003e' + incomplete\n  }\n})\n\nconsole.log(bar(50)) // =====\u003e-----\n```\n\n### `var str = bar(value)`\n\nCall the `bar` function with the `value` you want to the generated\nprogress bar to have.\n\nThe `bar` function will return a string representation of the progress\nbar.\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson%2Fprogress-string","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fwatson%2Fprogress-string","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fwatson%2Fprogress-string/lists"}