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.