阿西河

所有教程

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

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js fsPromises.writeFile

      Node.js fsPromises.writeFile(file, data[, options])

      新增于: v10.0.0

      • file < string> | < Buffer> | < URL> |filename or FileHandle
      • data < string> | < Buffer> |
      • options < Object> | < string>
        • encoding < string> | < null> Default: ‘utf8’
        • mode < integer> Default: 0o666
        • flag < string> See support of file system flags. Default: ‘w’.
      • Returns:

      Asynchronously writes data to a file, replacing the file if it already exists. data can be a string or a buffer. The Promise will be resolved with no arguments upon success.

      The encoding option is ignored if data is a buffer.

      If options is a string, then it specifies the encoding.

      Any specified FileHandle has to support writing.

      It is unsafe to use fsPromises.writeFile() multiple times on the same file without waiting for the Promise to be resolved (or rejected).


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


      目录
      本文目录
      目录