0

I am trying to teach myself about synchronous and asynchronous writing in node.js right now. Just out of interest I wanted to check all active threads while trying to write a random line into a txt.-file using fs.writeFile(). If there is any way to do so, I'd be pleased with an answer that could help me understand this subject.

lexbtw
  • 3
  • 2

1 Answers1

0

Rather than using multiple threads, it is much easier to use multiple processes in Node.js. For example, the cluster module can run the same js code in multiple processes.

For more information on cluster module : How to use clusters in node js?

For getting a list of all processes, please refer to this post : how to get the list of process.

For more information on threads in node.js refer to : https://nodejs.org/api/worker_threads.html

avr_dude
  • 233
  • 2
  • 8