阿西河

所有教程

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

我的收藏

    最近访问  (文章)

      教程列表

      抓包专区
      测试专区

      Node.js fs filehandle.writeFile

      Node.js fs filehandle.writeFile(data, options)

      新增于: v10.0.0

      • 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.

      The FileHandle has to support writing.

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

      If one or more filehandle.write() calls are made on a file handle and then a filehandle.writeFile() call is made, the data will be written from the current position till the end of the file. It doesn’t always write from the beginning of the file.


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


      目录
      本文目录
      目录