阿西河

所有教程

公众号
🌙
阿西河前端的公众号

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js fsPromises.mkdtemp

      Node.js fsPromises.mkdtemp(prefix[, options])

      新增于: v10.0.0

      • prefix < string>
      • options < string> | < Object>
        • encoding < string> Default: ‘utf8’
      • Returns:

      Creates a unique temporary directory and resolves the Promise with the created folder path. A unique directory name is generated by appending six random characters to the end of the provided prefix.

      The optional options argument can be a string specifying an encoding, or an object with an encoding property specifying the character encoding to use.

      fsPromises.mkdtemp(path.join(os.tmpdir(), 'foo-'))
        .catch(console.error);
      

      The fsPromises.mkdtemp() method will append the six randomly selected characters directly to the prefix string. For instance, given a directory /tmp, if the intention is to create a temporary directory within /tmp, the prefix must end with a trailing platform-specific path separator (require(‘path’).sep).


      更多内容请参考:Node.js fs 文件系统,或者通过 点击对应菜单 进行查看;


      目录
      本文目录
      目录