Sharing streams
So I have a small project where I want to use streams. But now I need two different transform streams on the same input
9 Replies
What I want to try and do is let
processingStream2
continue from where processStream1
left offa transform can only stop in the middle if it throws an error, otherwise it will consume all of its input
Even if .cancel() is used on the controller?
oh
I'm not actually sure about that
Cuz right now that is done, but the readable stream that feeds into the transformstream is still locked
Which means that I cannot reuse it :/
I don't think you can do that. But I don't think that's a bad thing.
Shit....
That really sucks for data that needs different processing...
To explain why, consider this implementation of
TextLineStream
:
there's data coming from previous chunks that hasn't been enqueued yet
so if you could get back to the original stream, you'd lose that dataHmmm. I guess I'll just use a reader and loop with that
It's just so annoying that a stream can't be reused or cloned from a certaint part
I guess I'll figure out another solution...
Cuz 1.5m nop fn calls are quite expensive...
Well thanks for the insight and help @Andreu Botella (he/they). I'm going to bed thinking of how to do this
It's also not possible to do this sequentially? Where one stream is done first and then the other one can go?