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


异步地将数据追加到文件,如果文件尚不存在则创建它。 data 可以是字符串、缓冲区、<AsyncIterable><Iterable> 对象。

🌐 Asynchronously append data to a file, creating the file if it does not yet data can be a string, a buffer, an <AsyncIterable>, or an <Iterable> object.

如果 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()).