fsPromises.rmdir(path[, options])
-
options<Object> 目前没有公开任何选项。recursive、maxBusyTries和emfileWait过去曾有选项,但它们已被弃用并移除。为了向后兼容,options参数仍然被接受,但已不再使用。¥
options<Object> There are currently no options exposed. There used to be options forrecursive,maxBusyTries, andemfileWaitbut they were deprecated and removed. Theoptionsargument is still accepted for backwards compatibility but it is not used. -
返回:<Promise> 成功时将使用
undefined履行。¥Returns: <Promise> Fulfills with
undefinedupon success.
删除由 path 标识的目录。
¥Removes the directory identified by path.
在文件(而不是目录)上使用 fsPromises.rmdir() 会导致 promise 被拒绝,在 Windows 上使用 ENOENT 错误,在 POSIX 上使用 ENOTDIR 错误。
¥Using fsPromises.rmdir() on a file (not a directory) results in the
promise being rejected with an ENOENT error on Windows and an ENOTDIR
error on POSIX.
要获得类似于 rm -rf Unix 命令的行为,则使用具有选项 { recursive: true, force: true } 的 fsPromises.rm()。
¥To get a behavior similar to the rm -rf Unix command, use
fsPromises.rm() with options { recursive: true, force: true }.