aboutsummaryrefslogtreecommitdiff
path: root/node_modules/duplexify
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-20 02:56:13 +0200
commitbbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch)
treec58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/duplexify
parent003fb34971cf63466184351b4db5f7c67df4f444 (diff)
update packages
Diffstat (limited to 'node_modules/duplexify')
-rw-r--r--node_modules/duplexify/.npmignore1
-rw-r--r--node_modules/duplexify/README.md2
-rw-r--r--node_modules/duplexify/index.js11
-rw-r--r--node_modules/duplexify/package.json2
-rw-r--r--node_modules/duplexify/test.js1
5 files changed, 11 insertions, 6 deletions
diff --git a/node_modules/duplexify/.npmignore b/node_modules/duplexify/.npmignore
deleted file mode 100644
index 3c3629e64..000000000
--- a/node_modules/duplexify/.npmignore
+++ /dev/null
@@ -1 +0,0 @@
-node_modules
diff --git a/node_modules/duplexify/README.md b/node_modules/duplexify/README.md
index 27669f6b6..8352900fc 100644
--- a/node_modules/duplexify/README.md
+++ b/node_modules/duplexify/README.md
@@ -46,7 +46,7 @@ If you call `setReadable` or `setWritable` multiple times it will unregister the
To disable the readable or writable part call `setReadable` or `setWritable` with `null`.
If the readable or writable streams emits an error or close it will destroy both streams and bubble up the event.
-You can also explictly destroy the streams by calling `dup.destroy()`. The `destroy` method optionally takes an
+You can also explicitly destroy the streams by calling `dup.destroy()`. The `destroy` method optionally takes an
error object as argument, in which case the error is emitted as part of the `error` event.
``` js
diff --git a/node_modules/duplexify/index.js b/node_modules/duplexify/index.js
index a04f124fa..ad36962c5 100644
--- a/node_modules/duplexify/index.js
+++ b/node_modules/duplexify/index.js
@@ -3,16 +3,22 @@ var eos = require('end-of-stream')
var inherits = require('inherits')
var shift = require('stream-shift')
-var SIGNAL_FLUSH = new Buffer([0])
+var SIGNAL_FLUSH = (Buffer.from && Buffer.from !== Uint8Array.from)
+ ? Buffer.from([0])
+ : new Buffer([0])
var onuncork = function(self, fn) {
if (self._corked) self.once('uncork', fn)
else fn()
}
+var autoDestroy = function (self, err) {
+ if (self._autoDestroy) self.destroy(err)
+}
+
var destroyer = function(self, end) {
return function(err) {
- if (err) self.destroy(err.message === 'premature close' ? null : err)
+ if (err) autoDestroy(self, err.message === 'premature close' ? null : err)
else if (end && !self._ended) self.end()
}
}
@@ -37,6 +43,7 @@ var Duplexify = function(writable, readable, opts) {
this._readable = null
this._readable2 = null
+ this._autoDestroy = !opts || opts.autoDestroy !== false
this._forwardDestroy = !opts || opts.destroy !== false
this._forwardEnd = !opts || opts.end !== false
this._corked = 1 // start corked
diff --git a/node_modules/duplexify/package.json b/node_modules/duplexify/package.json
index d226f1a29..dd8edaafa 100644
--- a/node_modules/duplexify/package.json
+++ b/node_modules/duplexify/package.json
@@ -1,6 +1,6 @@
{
"name": "duplexify",
- "version": "3.5.1",
+ "version": "3.6.0",
"description": "Turn a writable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input",
"main": "index.js",
"dependencies": {
diff --git a/node_modules/duplexify/test.js b/node_modules/duplexify/test.js
index f4856d39e..4330e93cf 100644
--- a/node_modules/duplexify/test.js
+++ b/node_modules/duplexify/test.js
@@ -260,7 +260,6 @@ tape('prefinish not twice', function(t) {
tape('close', function(t) {
var passthrough = through()
var dup = duplexify(passthrough, passthrough)
- var ok = false
passthrough.emit('close')
dup.on('close', function() {