Using fsPromises.rmdir() on a file (not a directory) results in the
promise being rejected with an ENOENT error on Windows and an ENOTDIRerror on POSIX.
To get a behavior similar to the rm -rf Unix command, use fsPromises.rm() with options { recursive: true, force: true }.
Removes the directory identified by
path.Using
fsPromises.rmdir()on a file (not a directory) results in the promise being rejected with anENOENTerror on Windows and anENOTDIRerror on POSIX.To get a behavior similar to the
rm -rfUnix command, usefsPromises.rm()with options{ recursive: true, force: true }.Since
v10.0.0
Returns
Fulfills with
undefinedupon success.