diff options
Diffstat (limited to 'deps/npm/node_modules/mississippi/node_modules/flush-write-stream')
5 files changed, 54 insertions, 12 deletions
diff --git a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/.npmignore b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/.npmignore index 3c3629e647..3e70011a19 100644 --- a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/.npmignore +++ b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/.npmignore @@ -1 +1,3 @@ node_modules +bundle.js +test.html diff --git a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/example.js b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/example.js new file mode 100644 index 0000000000..fa6b5dab25 --- /dev/null +++ b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/example.js @@ -0,0 +1,22 @@ +var writer = require('./') + +var ws = writer(write, flush) + +ws.on('finish', function () { + console.log('finished') +}) + +ws.write('hello') +ws.write('world') +ws.end() + +function write (data, enc, cb) { + // i am your normal ._write method + console.log('writing', data.toString()) + cb() +} + +function flush (cb) { + // i am called before finish is emitted + setTimeout(cb, 1000) // wait 1 sec +} diff --git a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js index d7715734b4..e82e126126 100644 --- a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js +++ b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/index.js @@ -1,5 +1,5 @@ var stream = require('readable-stream') -var util = require('util') +var inherits = require('inherits') var SIGNAL_FLUSH = new Buffer([0]) @@ -21,7 +21,7 @@ function WriteStream (opts, write, flush) { this._flush = flush || null } -util.inherits(WriteStream, stream.Writable) +inherits(WriteStream, stream.Writable) WriteStream.obj = function (opts, worker, flush) { if (typeof opts === 'function') return WriteStream.obj(null, opts, worker) @@ -47,6 +47,6 @@ WriteStream.prototype.end = function (data, enc, cb) { WriteStream.prototype.destroy = function (err) { if (this.destroyed) return this.destroyed = true - if (err) this.emit('error') + if (err) this.emit('error', err) this.emit('close') } diff --git a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/package.json b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/package.json index a73eaeb36e..cd239a22b5 100644 --- a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/package.json +++ b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/package.json @@ -14,15 +14,19 @@ ] ], "_from": "flush-write-stream@>=1.0.0 <2.0.0", - "_id": "flush-write-stream@1.0.0", + "_id": "flush-write-stream@1.0.2", "_inCache": true, "_location": "/mississippi/flush-write-stream", - "_nodeVersion": "4.1.1", + "_nodeVersion": "4.2.6", + "_npmOperationalInternal": { + "host": "packages-16-east.internal.npmjs.com", + "tmp": "tmp/flush-write-stream-1.0.2.tgz_1476614807882_0.22224654001183808" + }, "_npmUser": { "name": "mafintosh", "email": "mathiasbuus@gmail.com" }, - "_npmVersion": "2.14.4", + "_npmVersion": "2.14.12", "_phantomChildren": {}, "_requested": { "raw": "flush-write-stream@^1.0.0", @@ -36,8 +40,8 @@ "_requiredBy": [ "/mississippi" ], - "_resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.0.tgz", - "_shasum": "cc4fc24f4b4c973f80027f27cc095841639965a7", + "_resolved": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.2.tgz", + "_shasum": "c81b90d8746766f1a609a46809946c45dd8ae417", "_shrinkwrap": null, "_spec": "flush-write-stream@^1.0.0", "_where": "/Users/zkat/Documents/code/npm/node_modules/mississippi", @@ -49,6 +53,7 @@ "url": "https://github.com/mafintosh/flush-write-stream/issues" }, "dependencies": { + "inherits": "^2.0.1", "readable-stream": "^2.0.4" }, "description": "A write stream constructor that supports a flush function that is called before finish is emitted", @@ -57,10 +62,10 @@ }, "directories": {}, "dist": { - "shasum": "cc4fc24f4b4c973f80027f27cc095841639965a7", - "tarball": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.0.tgz" + "shasum": "c81b90d8746766f1a609a46809946c45dd8ae417", + "tarball": "https://registry.npmjs.org/flush-write-stream/-/flush-write-stream-1.0.2.tgz" }, - "gitHead": "50e81d8eeee8a9666c7d5105775a6c89b7ae9dfa", + "gitHead": "d35a4071dacbcc60fc40d798fa58fc425cba3efc", "homepage": "https://github.com/mafintosh/flush-write-stream", "license": "MIT", "main": "index.js", @@ -80,5 +85,5 @@ "scripts": { "test": "tape test.js" }, - "version": "1.0.0" + "version": "1.0.2" } diff --git a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/test.js b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/test.js index 7383acede6..6cd0c20e1f 100644 --- a/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/test.js +++ b/deps/npm/node_modules/mississippi/node_modules/flush-write-stream/test.js @@ -70,3 +70,16 @@ tape('can pass options', function (t) { process.nextTick(cb) } }) + +tape('emits error on destroy', function (t) { + var expected = new Error() + + var ws = writer({objectMode: true}, function () {}) + + ws.on('error', function (err) { + t.equal(err, expected) + }) + ws.on('close', t.end) + + ws.destroy(expected) +}) |