Q52: What is the difference between fs.readFile and fs.readFileSync?
fs.readFile reads files asynchronously without blocking the Event Loop. fs.readFileSync blocks code execution until reading completes.
Key Takeaways
fs.readFileis non-blocking asynchronous I/O.fs.readFileSyncblocks the main thread during file reading.
Knowledge Check
Which method should be avoided in production HTTP request handlers?