mafintosh / streamx

An iteration of the Node.js core streams with a series of improvements.
MIT License
226 stars 16 forks source link

Add unpipe method #64

Open tinchoz49 opened 2 years ago

tinchoz49 commented 2 years ago

Hi @mafintosh, this is my first attempt to add the unpipe method. https://github.com/streamxorg/streamx/issues/11

mafintosh commented 2 years ago

Curious, what is your usecase for unpipe? I haven't found any, since is why I haven't added it, but can be convinced

tinchoz49 commented 2 years ago

Yes, I never use it until today.

I'm working on a re-implementation of aws-lambda-fastify and I'm building a Readable Stream with streamx to simulate the http.IncomingMessage.

So the tests are not passing because of this: https://github.com/fastify/fastify-multipart/blob/master/index.js#L500 (first time I saw someone using unpipe)

tinchoz49 commented 2 years ago

btw I know that I can just extend from http.IncomingMessage and use the node Readable stream but with streamx I get a performance improve of almost 20k of req/seq more. The stream state lifecycle in streamx is more simple and faster.

tinchoz49 commented 2 years ago

I don't like the unpipe but maybe we can added only for compatibility support.

mafintosh commented 2 years ago

Okay nice! I can be convinced :)

James4Ever0 commented 1 year ago

unpipe could be added in order to fix issues like this when working with webtorrent and fluent-ffmpeg. Otherwise I have to monkey patch this object.

tforster commented 1 year ago

I don't like the unpipe but maybe we can added only for compatibility support.

Is there a better/different implementation/option for unpipe? I am using it in one of my projects and it is preventing me from upgrading to vinyl-fs 4.

phated commented 1 year ago

Is there a better/different implementation/option for unpipe? I am using it in one of my projects and it is preventing me from upgrading to vinyl-fs 4.

Sounds like your code is just written incorrectly.

tforster commented 1 year ago

Is there a better/different implementation/option for unpipe? I am using it in one of my projects and it is preventing me from upgrading to vinyl-fs 4.

Sounds like your code is just written incorrectly.

How so? unpipe is a valid stream method.