I have been working with Node.js streams for the past 6 months or so, and I have been really happy with them so far. All of the problems I have encountered thus far, I have been able to solve using the standard template of:
A.pipe(B).pipe(C);
However, my current problems requires chaining different stream "pipelines" based on run-time logic. For example, what I'd like to do is something like the following:
var basePipeline = A.pipe(B).pipe(C);
if(flowRate > 0.0) {
basePipeline.pipe(D).pipe(E).pipe(F);
} else {
basePipeline.pipe(G).pipe(H).pipe(I);
}
Is the above possible? Or, do I need to create both streams separately in a complete fashion:
if(flowRate > 0.0) {
A.pipe(B).pipe(C).pipe(D).pipe(E).pipe(F);
} else {
A.pipe(B).pipe(C).pipe(G).pipe(H).pipe(I);
}
Thanks for the advice!