Discard chunk in NodeJS Transform stream and read the next one

169
June 09, 2019, at 01:50 AM

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.

Answer 1

Write a Duplex stream and stick it in the middle.

To simplify that, look at libraries like event-stream which can simplify implementation.

Rent Charter Buses Company
READ ALSO
Facebook Messenger Bot Message is not coming to server

Facebook Messenger Bot Message is not coming to server

I have setup the Facebook Messenger by following correct stepsI could verify the webhook successfully as well as subscribed to the page

136
FacebookTokenError: This authorization code has been used passport-js

FacebookTokenError: This authorization code has been used passport-js

I have implemented log in with facebook using passportjs

116
Is there a way to refresh static files without server restart?

Is there a way to refresh static files without server restart?

My simple Nodejs app serves static files, e

92
Templating each array with Handlebars and Mongoose

Templating each array with Handlebars and Mongoose

I try to display results with Mongoose and Handlebars but I can'tIs this a problem withe the structure and the fact that the "results" arrays are strangely structured ? I want each object to be displayed in my page

132