fs.mkdtempDisposableSync(prefix[, options])


返回一个一次性对象,其 path 属性保存创建的目录路径。当对象被释放时,如果目录仍然存在,目录及其内容将被删除。如果目录无法删除,释放操作将抛出错误。该对象具有 remove() 方法,可执行相同的操作。

【Returns a disposable object whose path property holds the created directory path. 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.】

有关详细信息,请参阅 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.】