fs.mkdtempDisposableSync(prefix[, options])
prefix<string> | <Buffer> | <URL>options<string> | <Object>encoding<string> 默认:'utf8'
- 返回:<Object> 一次性物品:
path<string> | <Buffer> 已创建目录的路径。remove<Function> 一个用于删除已创建目录的函数。[Symbol.dispose]<Function> 与remove相同。
返回一个一次性对象,其 path 属性保存创建的目录路径。如果 encoding 为 'buffer',path 将是一个 <Buffer>。当对象被释放时,如果目录仍然存在,目录及其内容将被删除。如果目录无法删除,释放时会抛出错误。该对象有一个 remove() 方法,可以执行相同的操作。
🌐 Returns a disposable object whose path property holds the created directory
path. If encoding is 'buffer', the path will be a <Buffer>. When the
object is disposed, the directory and its contents will be removed if it still
exists. If the directory cannot be deleted, disposal will throw an error. The
object has a remove() method which will perform the same task.
查看 MDN 上关于 using 语句的文档 以获取更多关于显式资源管理的信息。
🌐 See the MDN documentation on using statements for more information about
explicit resource management.
有关详细信息,请参阅 fs.mkdtemp() 的文档。
🌐 For detailed information, see the documentation of fs.mkdtemp().
这个 API 没有基于回调的版本,因为它是为 using 语法设计的。
🌐 There is no callback-based version of this API because it is designed for use
with the using syntax.
可选的 options 参数可以是指定编码的字符串,或者是一个具有 encoding 属性的对象,用于指定要使用的字符编码。
🌐 The optional options argument can be a string specifying an encoding, or an
object with an encoding property specifying the character encoding to use.