The File System in Node.js: fs/promises, path, Buffer and File Handling Pitfalls
On a Node.js server, file work is done with node:fs/promises, but the real job is handling encodings correctly, writing files atomically and keeping user-supplied paths inside the root folder. With real output: an 8-character Turkish title taking 11 bytes, Turkish characters breaking at chunk boundaries, the BOM in Excel's CSV, 61 of 62 reads seeing a half-written file with writeFile, lost updates, the startsWith trap, and the Permission Model disabling fsync.
14 Nov 2026
·
17 min
·
10