question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Pipe event conflict with readable-stream v3 / node.js core

See original GitHub issue

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' }

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:17

github_iconTop GitHub Comments

2reactions
mafintoshcommented, Jul 30, 2020

Fixed and released in latest patch (bug fix).

I’ve also documented pipe/piping now so they are covered by semver 😃

2reactions
mafintoshcommented, May 13, 2020

@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!

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bountysource
Pipe event conflict with readable-stream v3 / node.js core.
Read more >
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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found