two types of memory - disk(permanent) , ram(temporary) RAM (Memory) → fast, temporary storage
Disk / SSD → slower, permanent storage
when we use fs.writeFileSync('file.txt', 'Hello World'); It directly goes to disk (blocking, slow).
we write the data directly on disk which is slow
But for performance, Node.js / OS often first writes to RAM, then later flushes to disk.
This RAM space where data waits before writing to disk is called a buffer.
Buffer = temporary RAM storage before disk write
Flush = send buffered data to disk immediately
.write() → goes to buffer, not disk
.end() → flush + close
fsyncSync(fd) → force OS flush to disk (extra safe)