streamx: Pipe event conflict with readable-stream v3 / node.js core
readable-stream v3 and node.js core use dest.emit('pipe', src)
while streamx uses src.emit('pipe', dest)
.
Demonstration script:
'use strict';
const streamx = require('streamx');
const stream = require('readable-stream');
const ids = new Map();
function watchPipe(self, stream) {
ids.set(stream, self);
stream.on('pipe', other => {
console.log('pipe', {
self,
other: ids.get(other)
});
});
}
function runTest(id, stream) {
watchPipe('stdout', process.stdout);
watchPipe('stdin', process.stdin);
watchPipe(id, stream);
stream.pipe(process.stdout);
process.stdin.pipe(stream);
}
if (process.argv.slice(2)[0]) {
runTest('streamx', new streamx.Transform());
} else {
runTest('readable-stream', new stream.PassThrough());
}
Run the script with and without an argument:
$ echo | node t.js
pipe { self: 'stdout', other: 'readable-stream' }
pipe { self: 'readable-stream', other: 'stdin' }
$ echo | node t.js 1
pipe { self: 'streamx', other: 'stdout' }
pipe { self: 'streamx', other: 'stdin' }
About this issue
- Original URL
- State: closed
- Created 4 years ago
- Comments: 17 (5 by maintainers)
Fixed and released in latest patch (bug fix).
I’ve also documented
pipe
/piping
now so they are covered by semver 😃@coreyfarrell let’s do another issue for the data listener, cause it triggers slow paths in streamx adding one, so let’s see if we can’t solve it
@phated uhhhh!