{"id":13526606,"url":"https://github.com/stream-utils/destroy","last_synced_at":"2025-04-09T05:09:42.305Z","repository":{"id":12868309,"uuid":"15544623","full_name":"stream-utils/destroy","owner":"stream-utils","description":"destroy a stream if possible","archived":false,"fork":false,"pushed_at":"2024-09-03T21:16:46.000Z","size":55,"stargazers_count":55,"open_issues_count":1,"forks_count":9,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-04-02T04:02:58.304Z","etag":null,"topics":["destroy","javascript","nodejs","stream"],"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/stream-utils.png","metadata":{"files":{"readme":"README.md","changelog":"HISTORY.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2013-12-31T06:36:59.000Z","updated_at":"2025-03-10T10:45:36.000Z","dependencies_parsed_at":"2024-10-22T14:59:10.502Z","dependency_job_id":null,"html_url":"https://github.com/stream-utils/destroy","commit_stats":{"total_commits":130,"total_committers":3,"mean_commits":"43.333333333333336","dds":0.09999999999999998,"last_synced_commit":"f387a486a42869ab8ef1c37a90922925063aeb57"},"previous_names":["stream-utils/dethroy"],"tags_count":8,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fdestroy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fdestroy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fdestroy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stream-utils%2Fdestroy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stream-utils","download_url":"https://codeload.github.com/stream-utils/destroy/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247457741,"owners_count":20941906,"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":["destroy","javascript","nodejs","stream"],"created_at":"2024-08-01T06:01:32.093Z","updated_at":"2025-04-09T05:09:42.284Z","avatar_url":"https://github.com/stream-utils.png","language":"JavaScript","readme":"# destroy\n\n[![NPM version][npm-image]][npm-url]\n[![Build Status][github-actions-ci-image]][github-actions-ci-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n\nDestroy a stream.\n\nThis module is meant to ensure a stream gets destroyed, handling different APIs\nand Node.js bugs.\n\n## API\n\n```js\nvar destroy = require('destroy')\n```\n\n### destroy(stream [, suppress])\n\nDestroy the given stream, and optionally suppress any future `error` events.\n\nIn most cases, this is identical to a simple `stream.destroy()` call. The rules\nare as follows for a given stream:\n\n  1. If the `stream` is an instance of `ReadStream`, then call `stream.destroy()`\n     and add a listener to the `open` event to call `stream.close()` if it is\n     fired. This is for a Node.js bug that will leak a file descriptor if\n     `.destroy()` is called before `open`.\n  2. If the `stream` is an instance of a zlib stream, then call `stream.destroy()`\n     and close the underlying zlib handle if open, otherwise call `stream.close()`.\n     This is for consistency across Node.js versions and a Node.js bug that will\n     leak a native zlib handle.\n  3. If the `stream` is not an instance of `Stream`, then nothing happens.\n  4. If the `stream` has a `.destroy()` method, then call it.\n\nThe function returns the `stream` passed in as the argument.\n\n## Example\n\n```js\nvar destroy = require('destroy')\n\nvar fs = require('fs')\nvar stream = fs.createReadStream('package.json')\n\n// ... and later\ndestroy(stream)\n```\n\n[npm-image]: https://img.shields.io/npm/v/destroy.svg?style=flat-square\n[npm-url]: https://npmjs.org/package/destroy\n[github-tag]: http://img.shields.io/github/tag/stream-utils/destroy.svg?style=flat-square\n[github-url]: https://github.com/stream-utils/destroy/tags\n[coveralls-image]: https://img.shields.io/coveralls/stream-utils/destroy.svg?style=flat-square\n[coveralls-url]: https://coveralls.io/r/stream-utils/destroy?branch=master\n[license-image]: http://img.shields.io/npm/l/destroy.svg?style=flat-square\n[license-url]: LICENSE.md\n[downloads-image]: http://img.shields.io/npm/dm/destroy.svg?style=flat-square\n[downloads-url]: https://npmjs.org/package/destroy\n[github-actions-ci-image]: https://img.shields.io/github/workflow/status/stream-utils/destroy/ci/master?label=ci\u0026style=flat-square\n[github-actions-ci-url]: https://github.com/stream-utils/destroy/actions/workflows/ci.yml\n","funding_links":[],"categories":["Repository","Modules"],"sub_categories":["Streams"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstream-utils%2Fdestroy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstream-utils%2Fdestroy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstream-utils%2Fdestroy/lists"}