CodeZettaInterview Hub

Node.js · File System · Fresh / Intern · Best Practice

fs.promises vs fs callbacks vs sync APIs — which in servers?

Short Interview Answer

Prefer promises/async in request paths; avoid sync fs (*Sync) on the event loop in production servers.

Detailed Explanation

Sync APIs block the loop. Callbacks still work but promises compose better. For CLIs/scripts, sync is sometimes acceptable.

Did you know this answer?