fs.rmdirSync(path[, options])


  • path <string> | <Buffer> | <URL>

  • options <Object> 目前没有公开任何选项。recursivemaxBusyTriesemfileWait 过去曾有选项,但它们已被弃用并移除。为了向后兼容,options 参数仍然被接受,但已不再使用。

    ¥options <Object> There are currently no options exposed. There used to be options for recursive, maxBusyTries, and emfileWait but they were deprecated and removed. The options argument is still accepted for backwards compatibility but it is not used.

同步 rmdir(2)。返回 undefined

¥Synchronous rmdir(2). Returns undefined.

在文件(而不是目录)上使用 fs.rmdirSync(),则在 Windows 上会导致 ENOENT 错误,在 POSIX 上会导致 ENOTDIR 错误。

¥Using fs.rmdirSync() 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.rmSync()

¥To get a behavior similar to the rm -rf Unix command, use fs.rmSync() with options { recursive: true, force: true }.