streamx: `streamx.pipe()` does not add a listener for `data` event.

streamx.pipe(dest) does not attach a data listener to streamx as stream v3 does. My goal is to migrate to-through from though2 to streamx.Transform, to do this I need to be able to know when streamx is piped to or from.

Stream code sometimes watches for the newListener event with data or readable for the argument.

Examples: https://github.com/mcollina/cloneable-readable/blob/f6bbe0a9da6561af84ec14ca1bc75c37c455f11c/index.js#L23-L38 https://github.com/gulpjs/to-through/blob/552d17efd3f9469166bc87832e77e86602850828/index.js#L34-L43

I’m not sure if it would be appropriate for ReadableState#pipe to call this.stream.emit('newListener', 'data') directly.

Related to #14

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 15 (8 by maintainers)

Most upvoted comments

I’m one of the maintainers of those.

The idea with streamx isn’t to be 100% compat, but to break compat if it means we can massively simplify/perf boost. That’s why pipe is different along with other tweaks.

We can probably add more explicit events to Node.js streams though. I’ll make an issue for that on Node.

@mafintosh thanks for adding the new events. Sorry I haven’t been about to give feedback / testing yet, life has pulled me in other directions for now.

@phated TBH it’s going to early next year before I’m able to put any serious effort into any open source code. In addition to current work commitments I am in the process of a long distance move. I have not forgotten about gulp and plan to work towards getting things migrated to streamx but I want to give reasonable expectation based on my schedule.