stream-connect
Advanced tools
Comparing version 0.2.2 to 0.2.3
@@ -46,13 +46,21 @@ 'use strict' | ||
connected._read = function () {} | ||
connected.on('finish', function () { | ||
one.end() | ||
}) | ||
connected | ||
.on('finish', function () { | ||
one.end() | ||
}) | ||
.on('pipe', function () { | ||
one.emit('pipe') | ||
}) | ||
/* use flowing rather than paused mode, for node 0.10 compatibility. */ | ||
two.on('data', function (chunk) { | ||
connected.push(chunk) | ||
}) | ||
two.on('end', function () { | ||
connected.push(null) | ||
}) | ||
two | ||
.on('data', function (chunk) { | ||
connected.push(chunk) | ||
}) | ||
.on('end', function () { | ||
connected.push(null) | ||
}) | ||
.on('error', function (err) { | ||
connected.emit('error', err) | ||
}) | ||
@@ -62,6 +70,4 @@ one.on('error', function (err) { | ||
}) | ||
two.on('error', function (err) { | ||
connected.emit('error', err) | ||
}) | ||
return connected | ||
@@ -68,0 +74,0 @@ } |
{ | ||
"name": "stream-connect", | ||
"author": "Lloyd Brookes <75pound@gmail.com>", | ||
"version": "0.2.2", | ||
"version": "0.2.3", | ||
"description": "Create a pipeline of connected streams", | ||
@@ -6,0 +6,0 @@ "repository": "https://github.com/75lb/stream-connect.git", |
@@ -44,13 +44,19 @@ var test = require('tape') | ||
test('pipe', function (t) { | ||
t.plan(2) | ||
t.plan(3) | ||
var pass1 = PassThrough() | ||
pass1.on('data', function (data) { | ||
t.strictEqual(data.toString(), 'test\n') | ||
}) | ||
var pass2 = PassThrough() | ||
pass2.on('data', function (data) { | ||
t.strictEqual(data.toString(), 'test\n') | ||
}) | ||
pass1 | ||
.on('pipe', function () { | ||
t.pass('"pipe" emitted') | ||
}) | ||
.on('data', function (data) { | ||
t.strictEqual(data.toString(), 'test\n', 'correct "data" 1') | ||
}) | ||
pass2 | ||
.on('data', function (data) { | ||
t.strictEqual(data.toString(), 'test\n', 'correct "data" 2') | ||
}) | ||
var connected = streamConnect(pass1, pass2) | ||
@@ -57,0 +63,0 @@ fs.createReadStream('test/fixture.txt', 'utf8').pipe(connected) |
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
9665
169