The fs.rmSync()
method is used to synchronously delete a file at the given path. It can also be used recursively to remove the directory by configuring the options object. It returns undefined.
fs.rmSync("path to directory", { recursive: true, force: true });