fsPromises.appendFile(path, data[, options])


异步地向文件追加数据,如果文件尚不存在则创建该文件。data 可以是字符串或 <Buffer>

【Asynchronously append data to a file, creating the file if it does not yet exist. data can be a string or a <Buffer>.】

如果 options 是一个字符串,那么它指定了 encoding

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

mode 选项只会影响新创建的文件。详情请参见 fs.open()

【The mode option only affects the newly created file. See fs.open() for more details.】

path 可以指定为已打开以进行追加的 <FileHandle>(使用 fsPromises.open())。

【The path may be specified as a <FileHandle> that has been opened for appending (using fsPromises.open()).】