diff options
Diffstat (limited to 'deps/npm/node_modules/mississippi/node_modules/end-of-stream')
9 files changed, 38 insertions, 332 deletions
diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/.npmignore b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/.npmignore deleted file mode 100644 index 3c3629e647..0000000000 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/.npmignore +++ /dev/null @@ -1 +0,0 @@ -node_modules diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/README.md b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/README.md index df800c1eb6..f2560c939d 100644 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/README.md +++ b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/README.md @@ -7,34 +7,35 @@ A node module that calls a callback when a readable/writable/duplex stream has c ## Usage Simply pass a stream and a callback to the `eos`. -Both legacy streams and streams2 are supported. +Both legacy streams, streams2 and stream3 are supported. ``` js var eos = require('end-of-stream'); eos(readableStream, function(err) { + // this will be set to the stream instance if (err) return console.log('stream had an error or closed early'); - console.log('stream has ended'); + console.log('stream has ended', this === readableStream); }); eos(writableStream, function(err) { if (err) return console.log('stream had an error or closed early'); - console.log('stream has finished'); + console.log('stream has finished', this === writableStream); }); eos(duplexStream, function(err) { if (err) return console.log('stream had an error or closed early'); - console.log('stream has ended and finished'); + console.log('stream has ended and finished', this === duplexStream); }); eos(duplexStream, {readable:false}, function(err) { if (err) return console.log('stream had an error or closed early'); - console.log('stream has ended but might still be writable'); + console.log('stream has finished but might still be readable'); }); eos(duplexStream, {writable:false}, function(err) { if (err) return console.log('stream had an error or closed early'); - console.log('stream has ended but might still be readable'); + console.log('stream has ended but might still be writable'); }); eos(readableStream, {error:false}, function(err) { @@ -44,4 +45,8 @@ eos(readableStream, {error:false}, function(err) { ## License -MIT
\ No newline at end of file +MIT + +## Related + +`end-of-stream` is part of the [mississippi stream utility collection](https://github.com/maxogden/mississippi) which includes more useful stream modules similar to this one. diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/index.js b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/index.js index f92fc19fef..b3a9068634 100644 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/index.js +++ b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/index.js @@ -27,21 +27,21 @@ var eos = function(stream, opts, callback) { var onfinish = function() { writable = false; - if (!readable) callback(); + if (!readable) callback.call(stream); }; var onend = function() { readable = false; - if (!writable) callback(); + if (!writable) callback.call(stream); }; var onexit = function(exitCode) { - callback(exitCode ? new Error('exited with error code: ' + exitCode) : null); + callback.call(stream, exitCode ? new Error('exited with error code: ' + exitCode) : null); }; var onclose = function() { - if (readable && !(rs && rs.ended)) return callback(new Error('premature close')); - if (writable && !(ws && ws.ended)) return callback(new Error('premature close')); + if (readable && !(rs && rs.ended)) return callback.call(stream, new Error('premature close')); + if (writable && !(ws && ws.ended)) return callback.call(stream, new Error('premature close')); }; var onrequest = function() { @@ -80,4 +80,4 @@ var eos = function(stream, opts, callback) { }; }; -module.exports = eos;
\ No newline at end of file +module.exports = eos; diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/LICENSE b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/LICENSE deleted file mode 100644 index 19129e315f..0000000000 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/LICENSE +++ /dev/null @@ -1,15 +0,0 @@ -The ISC License - -Copyright (c) Isaac Z. Schlueter and Contributors - -Permission to use, copy, modify, and/or distribute this software for any -purpose with or without fee is hereby granted, provided that the above -copyright notice and this permission notice appear in all copies. - -THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES -WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF -MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR -ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES -WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN -ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR -IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/README.md b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/README.md deleted file mode 100644 index a2981ea070..0000000000 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/README.md +++ /dev/null @@ -1,51 +0,0 @@ -# once - -Only call a function once. - -## usage - -```javascript -var once = require('once') - -function load (file, cb) { - cb = once(cb) - loader.load('file') - loader.once('load', cb) - loader.once('error', cb) -} -``` - -Or add to the Function.prototype in a responsible way: - -```javascript -// only has to be done once -require('once').proto() - -function load (file, cb) { - cb = cb.once() - loader.load('file') - loader.once('load', cb) - loader.once('error', cb) -} -``` - -Ironically, the prototype feature makes this module twice as -complicated as necessary. - -To check whether you function has been called, use `fn.called`. Once the -function is called for the first time the return value of the original -function is saved in `fn.value` and subsequent calls will continue to -return this value. - -```javascript -var once = require('once') - -function load (cb) { - cb = once(cb) - var stream = createStream() - stream.once('data', cb) - stream.once('end', function () { - if (!cb.called) cb(new Error('not found')) - }) -} -``` diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/once.js b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/once.js deleted file mode 100644 index 2e1e721bfe..0000000000 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/once.js +++ /dev/null @@ -1,21 +0,0 @@ -var wrappy = require('wrappy') -module.exports = wrappy(once) - -once.proto = once(function () { - Object.defineProperty(Function.prototype, 'once', { - value: function () { - return once(this) - }, - configurable: true - }) -}) - -function once (fn) { - var f = function () { - if (f.called) return f.value - f.called = true - return f.value = fn.apply(this, arguments) - } - f.called = false - return f -} diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/package.json b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/package.json deleted file mode 100644 index e7f66896b5..0000000000 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/node_modules/once/package.json +++ /dev/null @@ -1,108 +0,0 @@ -{ - "_args": [ - [ - { - "raw": "once@~1.3.0", - "scope": null, - "escapedName": "once", - "name": "once", - "rawSpec": "~1.3.0", - "spec": ">=1.3.0 <1.4.0", - "type": "range" - }, - "/Users/zkat/Documents/code/npm/node_modules/mississippi/node_modules/duplexify/node_modules/end-of-stream" - ], - [ - { - "raw": "once@~1.3.0", - "scope": null, - "escapedName": "once", - "name": "once", - "rawSpec": "~1.3.0", - "spec": ">=1.3.0 <1.4.0", - "type": "range" - }, - "/Users/zkat/Documents/code/npm/node_modules/mississippi/node_modules/end-of-stream" - ] - ], - "_from": "once@~1.3.0", - "_id": "once@1.3.3", - "_inCache": true, - "_location": "/mississippi/end-of-stream/once", - "_nodeVersion": "4.0.0", - "_npmUser": { - "name": "isaacs", - "email": "i@izs.me" - }, - "_npmVersion": "3.3.2", - "_phantomChildren": {}, - "_requested": { - "raw": "once@~1.3.0", - "scope": null, - "escapedName": "once", - "name": "once", - "rawSpec": "~1.3.0", - "spec": ">=1.3.0 <1.4.0", - "type": "range" - }, - "_requiredBy": [ - "/mississippi/end-of-stream" - ], - "_resolved": "https://registry.npmjs.org/once/-/once-1.3.3.tgz", - "_shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20", - "_shrinkwrap": null, - "_spec": "once@~1.3.0", - "_where": "/Users/zkat/Documents/code/npm/node_modules/mississippi/node_modules/end-of-stream", - "author": { - "name": "Isaac Z. Schlueter", - "email": "i@izs.me", - "url": "http://blog.izs.me/" - }, - "bugs": { - "url": "https://github.com/isaacs/once/issues" - }, - "dependencies": { - "wrappy": "1" - }, - "description": "Run a function exactly one time", - "devDependencies": { - "tap": "^1.2.0" - }, - "directories": { - "test": "test" - }, - "dist": { - "shasum": "b2e261557ce4c314ec8304f3fa82663e4297ca20", - "tarball": "https://registry.npmjs.org/once/-/once-1.3.3.tgz" - }, - "files": [ - "once.js" - ], - "gitHead": "2ad558657e17fafd24803217ba854762842e4178", - "homepage": "https://github.com/isaacs/once#readme", - "keywords": [ - "once", - "function", - "one", - "single" - ], - "license": "ISC", - "main": "once.js", - "maintainers": [ - { - "name": "isaacs", - "email": "i@izs.me" - } - ], - "name": "once", - "optionalDependencies": {}, - "readme": "ERROR: No README data found!", - "repository": { - "type": "git", - "url": "git://github.com/isaacs/once.git" - }, - "scripts": { - "test": "tap test/*.js" - }, - "version": "1.3.3" -} diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/package.json b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/package.json index 12a482c4b6..5610bee443 100644 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/package.json +++ b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/package.json @@ -1,46 +1,26 @@ { - "_args": [ - [ - { - "raw": "end-of-stream@^1.1.0", - "scope": null, - "escapedName": "end-of-stream", - "name": "end-of-stream", - "rawSpec": "^1.1.0", - "spec": ">=1.1.0 <2.0.0", - "type": "range" - }, - "/Users/zkat/Documents/code/npm/node_modules/mississippi" - ] - ], - "_from": "end-of-stream@>=1.1.0 <2.0.0", - "_id": "end-of-stream@1.1.0", - "_inCache": true, + "_from": "end-of-stream@^1.1.0", + "_id": "end-of-stream@1.4.0", + "_integrity": "sha1-epDYM+/abPpurA9JSduw+tOmMgY=", "_location": "/mississippi/end-of-stream", - "_npmUser": { - "name": "mafintosh", - "email": "mathiasbuus@gmail.com" - }, - "_npmVersion": "1.4.23", - "_phantomChildren": { - "wrappy": "1.0.2" - }, + "_phantomChildren": {}, "_requested": { + "type": "range", + "registry": true, "raw": "end-of-stream@^1.1.0", - "scope": null, - "escapedName": "end-of-stream", "name": "end-of-stream", + "escapedName": "end-of-stream", "rawSpec": "^1.1.0", - "spec": ">=1.1.0 <2.0.0", - "type": "range" + "saveSpec": null, + "fetchSpec": "^1.1.0" }, "_requiredBy": [ "/mississippi", "/mississippi/pump", "/mississippi/stream-each" ], - "_resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.1.0.tgz", - "_shasum": "e9353258baa9108965efc41cb0ef8ade2f3cfb07", + "_resolved": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.4.0.tgz", + "_shasum": "7a90d833efda6cfa6eac0f4949dbb0fad3a63206", "_shrinkwrap": null, "_spec": "end-of-stream@^1.1.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/mississippi", @@ -48,20 +28,20 @@ "name": "Mathias Buus", "email": "mathiasbuus@gmail.com" }, + "bin": null, "bugs": { "url": "https://github.com/mafintosh/end-of-stream/issues" }, + "bundleDependencies": false, "dependencies": { - "once": "~1.3.0" + "once": "^1.4.0" }, + "deprecated": false, "description": "Call a callback when a readable/writable/duplex stream has completed or failed.", "devDependencies": {}, - "directories": {}, - "dist": { - "shasum": "e9353258baa9108965efc41cb0ef8ade2f3cfb07", - "tarball": "https://registry.npmjs.org/end-of-stream/-/end-of-stream-1.1.0.tgz" - }, - "gitHead": "16120f1529961ffd6e48118d8d978c97444633d4", + "files": [ + "index.js" + ], "homepage": "https://github.com/mafintosh/end-of-stream", "keywords": [ "stream", @@ -74,15 +54,9 @@ ], "license": "MIT", "main": "index.js", - "maintainers": [ - { - "name": "mafintosh", - "email": "mathiasbuus@gmail.com" - } - ], "name": "end-of-stream", "optionalDependencies": {}, - "readme": "ERROR: No README data found!", + "peerDependencies": {}, "repository": { "type": "git", "url": "git://github.com/mafintosh/end-of-stream.git" @@ -90,5 +64,5 @@ "scripts": { "test": "node test.js" }, - "version": "1.1.0" + "version": "1.4.0" } diff --git a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/test.js b/deps/npm/node_modules/mississippi/node_modules/end-of-stream/test.js deleted file mode 100644 index 03cb93e2ed..0000000000 --- a/deps/npm/node_modules/mississippi/node_modules/end-of-stream/test.js +++ /dev/null @@ -1,77 +0,0 @@ -var assert = require('assert'); -var eos = require('./index'); - -var expected = 8; -var fs = require('fs'); -var cp = require('child_process'); -var net = require('net'); - -var ws = fs.createWriteStream('/dev/null'); -eos(ws, function(err) { - expected--; - assert(!!err); - if (!expected) process.exit(0); -}); -ws.close(); - -var rs = fs.createReadStream('/dev/random'); -eos(rs, function(err) { - expected--; - assert(!!err); - if (!expected) process.exit(0); -}); -rs.close(); - -var rs = fs.createReadStream(__filename); -eos(rs, function(err) { - expected--; - assert(!err); - if (!expected) process.exit(0); -}); -rs.pipe(fs.createWriteStream('/dev/null')); - -var rs = fs.createReadStream(__filename); -eos(rs, function(err) { - throw new Error('no go') -})(); -rs.pipe(fs.createWriteStream('/dev/null')); - -var exec = cp.exec('echo hello world'); -eos(exec, function(err) { - expected--; - assert(!err); - if (!expected) process.exit(0); -}); - -var spawn = cp.spawn('echo', ['hello world']); -eos(spawn, function(err) { - expected--; - assert(!err); - if (!expected) process.exit(0); -}); - -var socket = net.connect(50000); -eos(socket, function(err) { - expected--; - assert(!!err); - if (!expected) process.exit(0); -}); - -var server = net.createServer(function(socket) { - eos(socket, function() { - expected--; - if (!expected) process.exit(0); - }); - socket.destroy(); -}).listen(30000, function() { - var socket = net.connect(30000); - eos(socket, function() { - expected--; - if (!expected) process.exit(0); - }); -}); - -setTimeout(function() { - assert(expected === 0); - process.exit(0); -}, 1000); |