fs.rmdir(path[, options], callback)
-
options
<Object> 目前没有公开任何选项。recursive
、maxBusyTries
和emfileWait
过去曾有选项,但它们已被弃用并移除。为了向后兼容,options
参数仍然被接受,但已不再使用。¥
options
<Object> There are currently no options exposed. There used to be options forrecursive
,maxBusyTries
, andemfileWait
but they were deprecated and removed. Theoptions
argument is still accepted for backwards compatibility but it is not used. -
callback
<Function>err
<Error>
异步 rmdir(2)
。除了可能的异常之外,没有为完成回调提供任何参数。
¥Asynchronous rmdir(2)
. No arguments other than a possible exception are given
to the completion callback.
在文件(而不是目录)上使用 fs.rmdir()
,则在 Windows 上会导致 ENOENT
错误,在 POSIX 上会导致 ENOTDIR
错误。
¥Using fs.rmdir()
on a file (not a directory) results in an ENOENT
error on
Windows and an ENOTDIR
error on POSIX.
要获得类似于 rm -rf
Unix 命令的行为,则使用具有选项 { recursive: true, force: true }
的 fs.rm()
。
¥To get a behavior similar to the rm -rf
Unix command, use fs.rm()
with options { recursive: true, force: true }
.