[Node.js] Delete a directory synchronously

Created on November 28, 2026

You can use the rmSync method in the fs module to delete a directory synchronously. Pass the directory path as the first argument and an options object as the second. To delete a directory, set recursive to true.

import fs from "fs";

fs.rmSync("dummy_dir", { recursive: true });
Node.js