Node.js · Junior · Question 43 of 75
Why should you avoid fs.readFileSync inside an HTTP request handler?
- 1It works only on Windows
- 2It cannot read text files
- ✓Correct answer: It blocks the event loop, so no other request can be served until the file is read
Explanation
Sync calls are fine at startup (loading config) or in CLI scripts. In a server, use fs/promises or streams.