Beta 7 with some repo names changed.
This commit is contained in:
1 parent
0f7b40cca7
commit
963c19493a
3408 files changed
+462217
-15516
No files matched your search
+69
@@ -0,0 +1,69 @@
|
||||
/*!
|
||||
* unpipe
|
||||
* Copyright(c) 2015 Douglas Christopher Wilson
|
||||
* MIT Licensed
|
||||
*/
|
||||
|
||||
'use strict'
|
||||
|
||||
/**
|
||||
* Module exports.
|
||||
* @public
|
||||
*/
|
||||
|
||||
module.exports = unpipe
|
||||
|
||||
/**
|
||||
* Determine if there are Node.js pipe-like data listeners.
|
||||
* @private
|
||||
*/
|
||||
|
||||
function hasPipeDataListeners(stream) {
|
||||
var listeners = stream.listeners('data')
|
||||
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
if (listeners[i].name === 'ondata') {
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
return false
|
||||
}
|
||||
|
||||
/**
|
||||
* Unpipe a stream from all destinations.
|
||||
*
|
||||
* @param {object} stream
|
||||
* @public
|
||||
*/
|
||||
|
||||
function unpipe(stream) {
|
||||
if (!stream) {
|
||||
throw new TypeError('argument stream is required')
|
||||
}
|
||||
|
||||
if (typeof stream.unpipe === 'function') {
|
||||
// new-style
|
||||
stream.unpipe()
|
||||
return
|
||||
}
|
||||
|
||||
// Node.js 0.8 hack
|
||||
if (!hasPipeDataListeners(stream)) {
|
||||
return
|
||||
}
|
||||
|
||||
var listener
|
||||
var listeners = stream.listeners('close')
|
||||
|
||||
for (var i = 0; i < listeners.length; i++) {
|
||||
listener = listeners[i]
|
||||
|
||||
if (listener.name !== 'cleanup' && listener.name !== 'onclose') {
|
||||
continue
|
||||
}
|
||||
|
||||
// invoke the listener
|
||||
listener.call(stream)
|
||||
}
|
||||
}
|
||||
+63
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"_from": "unpipe@1.0.0",
|
||||
"_id": "unpipe@1.0.0",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
|
||||
"_location": "/unpipe",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "unpipe@1.0.0",
|
||||
"name": "unpipe",
|
||||
"escapedName": "unpipe",
|
||||
"rawSpec": "1.0.0",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "1.0.0"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/finalhandler",
|
||||
"/raw-body"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
|
||||
"_shasum": "b2bf4ee8514aae6165b4817829d21b2ef49904ec",
|
||||
"_spec": "unpipe@1.0.0",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AAMasters\\BackendServers\\node_modules\\raw-body",
|
||||
"author": {
|
||||
"name": "Douglas Christopher Wilson",
|
||||
"email": "doug@somethingdoug.com"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/stream-utils/unpipe/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Unpipe a stream from all destinations",
|
||||
"devDependencies": {
|
||||
"istanbul": "0.3.15",
|
||||
"mocha": "2.2.5",
|
||||
"readable-stream": "1.1.13"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">= 0.8"
|
||||
},
|
||||
"files": [
|
||||
"HISTORY.md",
|
||||
"LICENSE",
|
||||
"README.md",
|
||||
"index.js"
|
||||
],
|
||||
"homepage": "https://github.com/stream-utils/unpipe#readme",
|
||||
"license": "MIT",
|
||||
"name": "unpipe",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/stream-utils/unpipe.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "mocha --reporter spec --bail --check-leaks test/",
|
||||
"test-cov": "istanbul cover node_modules/mocha/bin/_mocha -- --reporter dot --check-leaks test/",
|
||||
"test-travis": "istanbul cover node_modules/mocha/bin/_mocha --report lcovonly -- --reporter spec --check-leaks test/"
|
||||
},
|
||||
"version": "1.0.0"
|
||||
}
|
||||
Reference in new issue
Block a user