How do I discard a chunk in a NodeJS transform stream and read the next one from the previous stream?
stream.on('data',function(data){}).pipe(rulesCheck).pipe(step1).pipe(step2).pipe(step3).pipe(insertDataIntoDB);
I would like to discard the chunk if it doesn't pass certain criteria in the ruleCheck stream.
Write a Duplex stream and stick it in the middle.
To simplify that, look at libraries like
event-streamwhich can simplify implementation.