Pipe event conflict with readable-stream v3 / node.js core
See original GitHub issuereadable-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' }
Issue Analytics
- State:
- Created 3 years ago
- Comments:17
Top Results From Across the Web
Backpressuring in Streams - Node.js
The pipe function helps to set up the appropriate backpressure closures for the event triggers. In Node.js the source is a Readable stream...
Read more >stream.finished behaviour change · Issue #29699 · nodejs/node
Some recent changes to stream.finished landed in Node master changes the ... Pipe event conflict with readable-stream v3 / node.js core ...
Read more >node.js - Unable to use one readable stream to write to two ...
createWriteStream(`${rootUploadPath}/${userId}/thumb_${randomString}`); const resizer2 = Sharp() .resize({ width: 45 }); await data.file .pipe( ...
Read more >Node.js Readable streams distilled
Node.js readable stream flowing and paused modes explained. ... public interface (i.e. the set of methods and events) is a bit inconsistent.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
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!