I'm working on a project where I need to create a video streaming server using Nodejs, and I've read here
that it is possible to do that, But now the question arises that if I create a new read stream using fs.createReadStream(path, {start: start, end: end});
then would it block a worker thread until the stream is closed? Because according to the Node's documentation it states that the fs
module utilises worker threads
, and we should avoid blocking the event loop as well as the worker threads. To summarize my question I would like to know do streams
block a thread until they are closed? or is the thread only used when we access the buffer to read a chunk of data from that stream? Also is it a bad idea to create a video streaming server using Nodejs? Thanks in Advance!
Asked
Active
Viewed 539 times
0

ansme
- 413
- 2
- 11
-
Where is the "fs" uses "worker threads" documented? You will most likely not get an usefull answer if anything is a "bad idea" on SO. – madflow Nov 14 '21 at 13:44
-
didn't do it myself, but video streaming is good and easy idea with node. take a look here for example: https://stackoverflow.com/questions/24976123/streaming-a-video-file-to-an-html5-video-player-with-node-js-so-that-the-video-c – Sefi R Nov 14 '21 at 16:38