CodeZettaInterview Hub

Node.js · File System · Mid-Level · Comparison

createReadStream vs readFile for large files?

Short Interview Answer

Streaming for large/unknown size; readFile loads entire content into memory.

Detailed Explanation

HTTP file serving should stream with proper headers. readFile is fine for small configs. Memory limits make this a production decision.

Did you know this answer?