Comparing version 3.0.0 to 3.0.1
@@ -25,2 +25,6 @@ var stream = require('stream') | ||
var toStreams2 = function(rs) { | ||
return new (stream.Readable)({objectMode:true, highWaterMark:16}).wrap(rs) | ||
} | ||
var Duplexify = function(writable, readable, opts) { | ||
@@ -133,3 +137,3 @@ if (!(this instanceof Duplexify)) return new Duplexify(writable, readable, opts) | ||
this._readable = readable | ||
this._readable2 = readable._readableState ? readable : new (stream.Readable)().wrap(readable) | ||
this._readable2 = readable._readableState ? readable : toStreams2(readable) | ||
this._readable2.on('readable', onreadable) | ||
@@ -136,0 +140,0 @@ this._readable2.on('end', onend) |
{ | ||
"name": "duplexify", | ||
"version": "3.0.0", | ||
"version": "3.0.1", | ||
"description": "Turn a writeable and readable stream into a streams2 duplex stream with support for async initialization and streams1/streams2 input", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
19
test.js
@@ -221,2 +221,21 @@ var tape = require('tape') | ||
dup.write('hello') | ||
}) | ||
tape('cork', function(t) { | ||
var passthrough = through() | ||
var dup = duplexify(passthrough, passthrough) | ||
var ok = false | ||
dup.on('prefinish', function() { | ||
dup.cork() | ||
setTimeout(function() { | ||
ok = true | ||
dup.uncork() | ||
}, 100) | ||
}) | ||
dup.on('finish', function() { | ||
t.ok(ok) | ||
t.end() | ||
}) | ||
dup.end() | ||
}) |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
13596
370