{"name":"destroy","description":"destroy a stream if possible","version":"1.1.0","author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"license":"MIT","repository":{"type":"git","url":"git+https://github.com/stream-utils/destroy.git"},"devDependencies":{"eslint":"7.32.0","eslint-config-standard":"14.1.1","eslint-plugin-import":"2.25.4","eslint-plugin-node":"11.1.0","eslint-plugin-promise":"5.2.0","eslint-plugin-standard":"4.1.0","mocha":"9.2.0","nyc":"15.1.0"},"engines":{"node":">= 0.8","npm":"1.2.8000 || >= 1.4.16"},"scripts":{"lint":"eslint .","test":"mocha --reporter spec","test-ci":"nyc --reporter=lcovonly --reporter=text npm test","test-cov":"nyc --reporter=html --reporter=text npm test"},"keywords":["stream","streams","destroy","cleanup","leak","fd"],"gitHead":"40e874982939d8d0b04afc8d1576307842b000d2","bugs":{"url":"https://github.com/stream-utils/destroy/issues"},"homepage":"https://github.com/stream-utils/destroy#readme","_id":"destroy@1.1.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"integrity":"sha512-R5QZrOXxSs0JDUIU/VANvRJlQVMts9C0L76HToQdPdlftfZCE7W6dyH0G4GZ5UW9fRqUOhAoCE2aGekuu+3HjQ==","shasum":"b77ae22e472d85437141319d32ae40b344dff38a","tarball":"http://registry-npm.ywwl.com/destroy/download/destroy-1.1.0.tgz","fileCount":4,"unpackedSize":7604,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJh8EgXCRA9TVsSAnZWagAAN0AP/099LQLye0ezRKzDBFO1\n9sTqui6s8gk3Bve4NE4hRLHiASPiR4sQ9ny2PvHkilR8q0ybTFNODcj/3BPC\nLcvB8XpT1aTs04tIOw2WUNHA738PhG/TQDy8nDZanA2ZKOAESBZRAJyx8iHw\n2pTJC0brDshttzulZWfQG13lpAMH3hQsId+yKHShTu6gpbSfE2FiJicxpzHP\nFkBb30yLGA8TOhd4wKnsso32ppgMa3otipkySg2W64E8KvGFPWtFmTpmJEyE\nyKX1vg0A5Q2+6Jhq82UaTiwrjSrEVLgHrIUp/00Wr5lfzfLOIe2Xqng8oE1z\naVa0aXAzxKSIuyL6bE8LEwLgz7zbVil9bI8xUFo1XEgrwc6/YQds/5xHbIkU\n7Ecyxeb7LBtpIVdOdXd04Ahs+SvOnRaO4sjKLAgmfmHD9Vf/+RFBpwHT1Ces\nhlGnHQMXvBoaExc2PZw22JKZ0ZKsHHycE3C8lefRxa2zA6ZoqGoYFX6unwij\n1zaXqFkOEOEW9Jw/hyEyFTsDMbhye84XdA/eQs0PV+de3kIevsglZYSkmUbw\njS71+tRDVePB41i4I/ovYseC+7wmC5InmebK0ROGJ3G0Ba1+fc9S9haANbxq\nMQjZHBiEODSfR1jMFnSZbxhcGk0NWYwfkzkq9l+SjH1iLM3BleNmYZ5veUzC\nOG+F\r\n=VXVf\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIFqMP66wjv4rJ89sHGF7xzFRWFZFvzwiAYPjhb5KKCutAiEAkiTx/rOxl3cJSoAYiW8zIcYgHMatmeMy1Os+wJI4/ZI="}],"size":2988,"noattachment":false,"key":"/destroy/-/destroy-1.1.0.tgz"},"_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"directories":{},"maintainers":[{"name":"dougwilson","email":"doug@somethingdoug.com"},{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/destroy_1.1.0_1643137047375_0.3416969550105049"},"_hasShrinkwrap":false,"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&style=flat-square\n[github-actions-ci-url]: https://github.com/stream-utils/destroy/actions/workflows/ci.yml\n","publish_time":1643137047526,"_cnpm_publish_time":1643137047526,"dist-tags":{"latest":"1.2.0"}}