A B C D E F G H I J K L M N O P Q R S T U V W X Y Z

Do streams in Node.js block the event loop?

Best Answers

It blocks only if you using the streaming functionality in synchronous mode. As Node.Js provide both ways to read file (synchronous as well as asynchronous) var fs = require("fs"); // importing fs module of Node. read more

Every event blocks the loop until completion. Streams, though, are describable as a series of fulfilled promises, which means there is no waiting. The stream is what you were waiting for. read more

This is basically what node does, its an"event-loop" its polling IO for completion(or progress) on a loop. So when a task does not complete(your loop) the event loop does not progress. To put it simply. read more

The Event Loop notices each new client connection and orchestrates the generation of a response. All incoming requests and outgoing responses pass through the Event Loop. This means that if the Event Loop spends too long at any point, all current and new clients will not get a turn. You should make sure you never block the Event Loop. read more

Encyclopedia Research

Wikipedia:

Related Question Categories