{"_id":"progress-ex","_rev":"4244906","name":"progress-ex","description":"Flexible ascii progress bar","dist-tags":{"latest":"2.0.0"},"maintainers":[{"name":"develar","email":""}],"time":{"modified":"2026-03-29T21:28:50.000Z","created":"2017-02-07T08:02:00.891Z","2.0.0":"2017-02-07T08:02:00.891Z"},"users":{},"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"repository":{"type":"git","url":"git://github.com/develar/node-progress.git"},"versions":{"2.0.0":{"name":"progress-ex","version":"2.0.0","description":"Flexible ascii progress bar","keywords":["cli","progress"],"author":{"name":"TJ Holowaychuk","email":"tj@vision-media.ca"},"contributors":[{"name":"Christoffer Hallas","email":"christoffer.hallas@gmail.com"},{"name":"Jordan Scales","email":"scalesjordan@gmail.com"}],"main":"index","repository":{"type":"git","url":"git://github.com/develar/node-progress.git"},"license":"MIT","files":["lib","*.js","index.d.ts"],"typings":"./index.d.ts","gitHead":"191256e02ec20c89b2e2834e25d17c3a7257d18a","bugs":{"url":"https://github.com/develar/node-progress/issues"},"homepage":"https://github.com/develar/node-progress#readme","_id":"progress-ex@2.0.0","scripts":{},"_shasum":"0292fe0d5c70e75ad6accf71d5bd1b92a4d34ee7","_from":".","_npmVersion":"4.1.2","_nodeVersion":"7.5.0","_npmUser":{"name":"develar","email":"develar@gmail.com"},"dist":{"shasum":"0292fe0d5c70e75ad6accf71d5bd1b92a4d34ee7","size":5854,"noattachment":false,"key":"/progress-ex/-/progress-ex-2.0.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/progress-ex/download/progress-ex-2.0.0.tgz"},"maintainers":[{"name":"develar","email":""}],"_npmOperationalInternal":{"host":"packages-18-east.internal.npmjs.com","tmp":"tmp/progress-ex-2.0.0.tgz_1486454520347_0.33113757194951177"},"directories":{},"publish_time":1486454520891,"_hasShrinkwrap":false,"_cnpm_publish_time":1486454520891,"_cnpmcore_publish_time":"2021-12-17T01:45:35.802Z"}},"readme":"Flexible ascii progress bar.\n\n## Installation\n\n```bash\n$ npm install progress\n```\n\n## Usage\n\nFirst we create a `ProgressBar`, giving it a format string\nas well as the `total`, telling the progress bar when it will\nbe considered complete. After that all we need to do is `tick()` appropriately.\n\n```javascript\nvar ProgressBar = require('progress');\n\nvar bar = new ProgressBar(':bar', { total: 10 });\nvar timer = setInterval(function () {\n  bar.tick();\n  if (bar.complete) {\n    console.log('\\ncomplete\\n');\n    clearInterval(timer);\n  }\n}, 100);\n```\n\n### Options\n\nThese are keys in the options object you can pass to the progress bar along with\n`total` as seen in the example above.\n\n- `curr` current completed index\n- `total` total number of ticks to complete\n- `width` the displayed width of the progress bar defaulting to total\n- `stream` the output stream defaulting to stderr\n- `head` head character defaulting to complete character\n- `complete` completion character defaulting to \"=\"\n- `incomplete` incomplete character defaulting to \"-\"\n- `renderThrottle` minimum time between updates in milliseconds defaulting to 16\n- `clear` option to clear the bar on completion defaulting to false\n- `callback` optional function to call when the progress bar completes\n\n### Tokens\n\nThese are tokens you can use in the format of your progress bar.\n\n- `:bar` the progress bar itself\n- `:current` current tick number\n- `:total` total ticks\n- `:elapsed` time elapsed in seconds\n- `:percent` completion percentage\n- `:eta` estimated completion time in seconds\n- `:rate` rate of ticks per second\n\n### Custom Tokens\n\nYou can define custom tokens by adding a `{'name': value}` object parameter to your method (`tick()`, `update()`, etc.) calls.\n\n```javascript\nvar bar = new ProgressBar(':current: :token1 :token2', { total: 3 })\nbar.tick({\n  'token1': \"Hello\",\n  'token2': \"World!\\n\"\n})\nbar.tick(2, {\n  'token1': \"Goodbye\",\n  'token2': \"World!\"\n})\n```\nThe above example would result in the output below.\n\n```\n1: Hello World!\n3: Goodbye World!\n```\n\n## Examples\n\n### Download\n\nIn our download example each tick has a variable influence, so we pass the chunk\nlength which adjusts the progress bar appropriately relative to the total\nlength.\n\n```javascript\nvar ProgressBar = require('progress');\nvar https = require('https');\n\nvar req = https.request({\n  host: 'download.github.com',\n  port: 443,\n  path: '/visionmedia-node-jscoverage-0d4608a.zip'\n});\n\nreq.on('response', function(res){\n  var len = parseInt(res.headers['content-length'], 10);\n\n  console.log();\n  var bar = new ProgressBar('  downloading [:bar] :rate/bps :percent :etas', {\n    complete: '=',\n    incomplete: ' ',\n    width: 20,\n    total: len\n  });\n\n  res.on('data', function (chunk) {\n    bar.tick(chunk.length);\n  });\n\n  res.on('end', function () {\n    console.log('\\n');\n  });\n});\n\nreq.end();\n```\n\nThe above example result in a progress bar like the one below.\n\n```\ndownloading [=====             ] 39/bps 29% 3.7s\n```\n\n### Interrupt\n\nTo display a message during progress bar execution, use `interupt()`\n```javascript\nvar ProgressBar = require('progress');\n\nvar bar = new ProgressBar(':bar :current/:total', { total: 10 });\nvar timer = setInterval(function () {\n  bar.tick();\n  if (bar.complete) {\n    clearInterval(timer);\n  } else if (bar.curr === 5) {\n      bar.interrupt('this message appears above the progress bar\\ncurrent progress is ' + bar.curr + '/' + bar.total);\n  }\n}, 1000);\n```\n\nYou can see more examples in the `examples` folder.\n\n## License\n\nMIT\n","_attachments":{},"homepage":"https://github.com/develar/node-progress#readme","bugs":{"url":"https://github.com/develar/node-progress/issues"},"license":"MIT"}