Thursday, 13 September 2018

Anyone explain this small snippet using concat-stream?

Im having a small brain fart on this snippet, was hoping someone could explain it to me.http.get(url, function(res){ res.on('error', console.log); res.setEncoding('utf8'); res.pipe(concatStream(function(data){ // Do stuff })); }) Can somebody explain to me theres.pipe(concatStream(function(data) { // Do Stuff })) Im learning nodejs for fun, but can't understand the process of events here. So its just concatenating the data response, but in what order does what happen first.You get the responseYou pipe it, which calls the concatStream(function(data) {})So it concatenates the data then calls the function?Just a nice explanation would be really helpful, sorry for such a noob question.

Submitted September 14, 2018 at 05:43AM by ZiiC

No comments:

Post a Comment