UNPKG

yunlongzha_try_nodejs

Version:

try it

1 lines 5.97 kB
{"_id":"destroy","_rev":"10-a7b732866860fae596495a9185cbceed","name":"destroy","time":{"modified":"2016-01-16T03:14:05.899Z","created":"2013-10-03T17:12:42.209Z","0.0.0":"2013-10-03T17:12:45.167Z","1.0.3":"2014-08-15T06:30:06.962Z","1.0.4":"2016-01-16T03:14:05.899Z"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"}],"dist-tags":{"latest":"1.0.4"},"description":"destroy a stream if possible","readme":"# Destroy\n\n[![NPM version][npm-image]][npm-url]\n[![Build status][travis-image]][travis-url]\n[![Test coverage][coveralls-image]][coveralls-url]\n[![License][license-image]][license-url]\n[![Downloads][downloads-image]][downloads-url]\n[![Gittip][gittip-image]][gittip-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)\n\nDestroy the given stream. In most cases, this is identical to a simple\n`stream.destroy()` call. The rules are 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 not an instance of `Stream`, then nothing happens.\n 3. 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[travis-image]: https://img.shields.io/travis/stream-utils/destroy.svg?style=flat-square\n[travis-url]: https://travis-ci.org/stream-utils/destroy\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[gittip-image]: https://img.shields.io/gittip/jonathanong.svg?style=flat-square\n[gittip-url]: https://www.gittip.com/jonathanong/\n","versions":{"1.0.3":{"name":"destroy","description":"destroy a stream if possible","version":"1.0.3","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":"https://github.com/stream-utils/destroy"},"devDependencies":{"istanbul":"0","mocha":"1"},"scripts":{"test":"mocha --reporter spec","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"},"files":["index.js"],"keywords":["stream","streams","destroy","cleanup","leak","fd"],"gitHead":"50af95ece4a70202f9301bc3edc8f9fdbbad0f26","bugs":{"url":"https://github.com/stream-utils/destroy/issues"},"homepage":"https://github.com/stream-utils/destroy","_id":"destroy@1.0.3","_shasum":"b433b4724e71fd8551d9885174851c5fc377e2c9","_from":".","_npmVersion":"1.4.21","_npmUser":{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"}],"dist":{"shasum":"b433b4724e71fd8551d9885174851c5fc377e2c9","tarball":"http://registry.npmjs.org/destroy/-/destroy-1.0.3.tgz"},"directories":{}},"1.0.4":{"name":"destroy","description":"destroy a stream if possible","version":"1.0.4","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":"https://github.com/stream-utils/destroy"},"devDependencies":{"istanbul":"0.4.2","mocha":"2.3.4"},"scripts":{"test":"mocha --reporter spec","test-cov":"istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot","test-travis":"istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter dot"},"files":["index.js","LICENSE"],"keywords":["stream","streams","destroy","cleanup","leak","fd"],"gitHead":"86edea01456f5fa1027f6a47250c34c713cbcc3b","bugs":{"url":"https://github.com/stream-utils/destroy/issues"},"homepage":"https://github.com/stream-utils/destroy","_id":"destroy@1.0.4","_shasum":"978857442c44749e4206613e37946205826abd80","_from":".","_npmVersion":"1.4.28","_npmUser":{"name":"dougwilson","email":"doug@somethingdoug.com"},"maintainers":[{"name":"jongleberry","email":"jonathanrichardong@gmail.com"},{"name":"dougwilson","email":"doug@somethingdoug.com"}],"dist":{"shasum":"978857442c44749e4206613e37946205826abd80","tarball":"http://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz"},"directories":{}}},"homepage":"https://github.com/stream-utils/destroy","keywords":["stream","streams","destroy","cleanup","leak","fd"],"repository":{"type":"git","url":"https://github.com/stream-utils/destroy"},"contributors":[{"name":"Douglas Christopher Wilson","email":"doug@somethingdoug.com"}],"author":{"name":"Jonathan Ong","email":"me@jongleberry.com","url":"http://jongleberry.com"},"bugs":{"url":"https://github.com/stream-utils/destroy/issues"},"license":"MIT","readmeFilename":"README.md","users":{"goodseller":true,"kankungyip":true},"_attachments":{},"_etag":"\"6ICSG9ZCQ6K3WCJ4YMYDZOV28\""}