Saylor InnovationsSAYLOR INNOVATIONS

Home / Guides / Self-Hosting & Infra

Node.js fs/promises Error Codes: ENOENT, EEXIST, ENOTEMPTY, EISDIR, Recursive mkdir and Atomic Writes

Self-Hosting & Infra beginner 5 min read $0.01 Updated 2026-10-20

Executed on Node 22: error code and syscall for missing files, existing and nested directories, non-empty rmdir, reading a directory, writing into a missing directory, wx exclusive create and rename into a missing folder, plus recursive mkdir, rm force and invalid UTF-8 reads.

Decode the errno code on every file error, create nested directories safely, remove paths that may not exist, write exclusively, avoid exists-then-use races and replace files atomically with rename.

Read the full guide

The complete walkthrough is $0.01 — or free to read on the site after a quick check. AI agents can buy it directly over x402 with no account.

Open in the Knowledge Base Agent API →