Deno.makeTempDir

\color{red}{function} Deno.makeTempDir(optins?: MakeTempOptions): Promise<string>

\color{red}{作用}

除非指定dir,否则在默认目录中为临时文件创建一个新的临时目录。 其他可选选项包括分别用前缀和后缀在目录名称前添加前缀和后缀。
该调用将解析为新创建目录的完整路径。
多个同时调用此函数的程序将创建不同的目录。 不再需要该目录时,调用方有责任删除它。

Creates a new temporary directory in the default directory for temporary files, unless dir is specified. Other optional options include prefixing and suffixing the directory name with prefix and suffix respectively.
This call resolves to the full path to the newly created directory.
Multiple programs calling this function simultaneously will create different directories. It is the caller's responsibility to remove the directory when no longer needed.

\color{red}{参数}

optins?: MakeTempOptions

optins?: MakeTempOptions

\color{red}{返回值}

Promise<string>

Promise<string>

\color{red}{示列代码}

const tempDirName0 = await Deno.makeTempDir();  // e.g. /tmp/2894ea76
const tempDirName1 = await Deno.makeTempDir({ prefix: 'my_temp' }); // e.g. /tmp/my_temp339c944d

\color{red}{其它}

需要提供 allow-write 权限。

Requires allow-write permission.

原文地址:点此跳转

Deno 目录

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容