{"id":17398484,"url":"https://github.com/vweevers/on-stream-close","last_synced_at":"2026-05-08T13:40:38.597Z","repository":{"id":57314437,"uuid":"282177052","full_name":"vweevers/on-stream-close","owner":"vweevers","description":"Callback when a stream has closed.","archived":false,"fork":false,"pushed_at":"2020-07-24T09:25:57.000Z","size":3,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-28T21:39:07.234Z","etag":null,"topics":["close","nodejs","npm-package","readable-stream","stream","streamx"],"latest_commit_sha":null,"homepage":"","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/vweevers.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2020-07-24T09:23:29.000Z","updated_at":"2020-07-24T09:26:00.000Z","dependencies_parsed_at":"2022-09-20T23:20:42.968Z","dependency_job_id":null,"html_url":"https://github.com/vweevers/on-stream-close","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fon-stream-close","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fon-stream-close/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fon-stream-close/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/vweevers%2Fon-stream-close/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/vweevers","download_url":"https://codeload.github.com/vweevers/on-stream-close/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246237436,"owners_count":20745348,"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":["close","nodejs","npm-package","readable-stream","stream","streamx"],"created_at":"2024-10-16T14:57:18.249Z","updated_at":"2026-05-08T13:40:36.777Z","avatar_url":"https://github.com/vweevers.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# on-stream-close\n\n**Callback when a stream has closed.** Alternative to [`stream.finished`](https://nodejs.org/api/stream.html#stream_stream_finished_stream_options_callback) and its predecessor [`end-of-stream`](https://github.com/mafintosh/end-of-stream) that utilize other events (like `end` and `finish`) which makes them compatible with older streams but they can't guarantee the stream has fully cleaned up its resources.\n\n[![npm status](http://img.shields.io/npm/v/on-stream-close.svg)](https://www.npmjs.org/package/on-stream-close)\n[![node](https://img.shields.io/node/v/on-stream-close.svg)](https://www.npmjs.org/package/on-stream-close)\n[![Travis build status](https://img.shields.io/travis/com/vweevers/on-stream-close.svg?label=travis)](http://travis-ci.com/vweevers/on-stream-close)\n[![JavaScript Style Guide](https://img.shields.io/badge/code_style-standard-brightgreen.svg)](https://standardjs.com)\n\n## Usage\n\n```js\nconst osc = require('on-stream-close')\n\nosc(stream, function (err) {\n  // Stream has closed\n})\n```\n\nWith promises:\n\n```js\nconst osc = require('on-stream-close').promises\n\nawait osc(stream)\n```\n\n## Compatible stream flavors\n\n- [`stream`](https://nodejs.org/api/stream.html): node \u003e= 14.0.0 or \u003e= 10.16.0 if `autoDestroy` is set to `true` by implementation\n- [`readable-stream`](https://github.com/nodejs/readable-stream): \u003e= 3.5.0 if `autoDestroy` is set to `true` by implementation\n- [`streamx`](https://github.com/mafintosh/streamx): always\n- [`minipass`](https://github.com/isaacs/minipass): not out of the box, an implementation can choose to emit close.\n\n## Install\n\nWith [npm](https://npmjs.org) do:\n\n```\nnpm install on-stream-close\n```\n\n## License\n\n[MIT](LICENSE.md) © 2020-present Vincent Weevers\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fon-stream-close","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fvweevers%2Fon-stream-close","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fvweevers%2Fon-stream-close/lists"}