{"id":18669962,"url":"https://github.com/blahah/fs-readstream-progress","last_synced_at":"2025-08-15T22:16:03.359Z","repository":{"id":57242328,"uuid":"89858118","full_name":"blahah/fs-readstream-progress","owner":"blahah","description":"fs.createReadStream wrapper that emits progress events. Also works with hyperdrive.","archived":false,"fork":false,"pushed_at":"2018-05-30T18:07:51.000Z","size":8,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-05-18T08:35:17.736Z","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":"cc0-1.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/blahah.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":"2017-04-30T15:10:14.000Z","updated_at":"2018-07-24T13:10:05.000Z","dependencies_parsed_at":"2022-09-08T00:40:51.820Z","dependency_job_id":null,"html_url":"https://github.com/blahah/fs-readstream-progress","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/blahah/fs-readstream-progress","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blahah%2Ffs-readstream-progress","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blahah%2Ffs-readstream-progress/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blahah%2Ffs-readstream-progress/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blahah%2Ffs-readstream-progress/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/blahah","download_url":"https://codeload.github.com/blahah/fs-readstream-progress/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/blahah%2Ffs-readstream-progress/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270637493,"owners_count":24620426,"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","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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-11-07T08:49:20.823Z","updated_at":"2025-08-15T22:16:03.336Z","avatar_url":"https://github.com/blahah.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"---\n\n\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003efs-readstream-progress\u003c/h1\u003e\n  \u003ch2\u003efs.createReadStream that emits progress events. Also works with hyperdrive.\u003c/h2\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://npmjs.com/packages/fs-readstream-progress\" alt=\"npm package\"\u003e\n      \u003cimg src=\"https://img.shields.io/npm/v/fs-readstream-progress.svg?style=flat-square\"\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://github.com/blahah/fs-readstream-progress/blob/master/LICENSE\" alt=\"CC0 public domain\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/license-CC0-ff69b4.svg?style=flat-square\"\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n---\n\n## What problem does this solve?\n\nTrack the progress of `readStream`s for Node `fs` or [`hyperdrive`](https://github.com/mafintosh/hyperdrive) archives.\n\n## Install\n\n```\nnpm install fs-readstream-progress\n```\n\n## Usage\n\nUse it like `fs.createReadStream`, except that:\n\n- it also emits `progress` events\n- you can pass an alternative `fs`\n- it has a convenient `.drain()` method\n\nAPI:\n\n```js\nvar getwithprogress = require('fs-readstream-progress')\n\nvar stream = getwithprogress(filename, opts)\n```\n\n### Progress events\n\nExample:\n\n``` js\nvar progress = require('fs-readstream-progress')\n\nprogress('somefile')\n  .on('progress', function (data) { console.log('progress:', data) })\n  .on('data', function(data) {})\n  .on('end', function() { console.log('done') })\n```\n\nEach `progress` event looks like:\n\n```js\n{\n  done: 16, // integer, number of bytes streamed so far\n  total: 256, // integer, total number of bytes\n  progress: 0.0625 // float, proportion of the data streamed\n}\n```\n\nWhen all the data have been streamed, the stream will emit `end`, just like `fs.createReadStream`.\n\n### Different `fs`\n\nTo use a different `fs` implementation (e.g. a hyperdrive archive), just pass\n\n```\nvar hyperdrive = require('hyperdrive')\nvar getwithprogress = require('fs-readstream-progress')\n\nvar archive = hyperdrive('.')\nvar stream = getwithprogress('somefile', { fs: archive })\n```\n\n### `.drain()`\n\nDrains the stream, pulling all data through without keeping it in memory.\n\nThis is useful if you just want to track a download from a hyperdrive archive.\n\n## License\n\nTo the extent possible by law, we transfer any rights we have in this code to the public domain. Specifically, we do so using the [CC0 1.0 Universal Public Domain Dedication](https://creativecommons.org/publicdomain/zero/1.0/).\n\nYou can do whatever you want with this code. No need to credit us, link to us, include any license, or anything else. But if you want to do those things, you're free to do that too.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblahah%2Ffs-readstream-progress","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fblahah%2Ffs-readstream-progress","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fblahah%2Ffs-readstream-progress/lists"}