fsPromises.appendFile(path, data[, options])
path<string> | <Buffer> | <URL> | <FileHandle> 文件名或FileHandledata<string> | <Buffer>options<Object> | <string>encoding<string> | <null> 默认值:'utf8'mode<integer> 默认值:0o666flag<string> 请参阅对文件系统flags的支持。 默认值:'a'。
- 返回: <Promise>
异步地将数据追加到文件,如果该文件尚不存在,则创建该文件。
data 可以是字符串或 Buffer。
如果 options 是字符串,则它指定编码。
可以将 path 指定为已打开用于追加(使用 fsPromises.open())的 FileHandle。
path<string> | <Buffer> | <URL> | <FileHandle> filename orFileHandledata<string> | <Buffer>options<Object> | <string>encoding<string> | <null> Default:'utf8'mode<integer> Default:0o666flag<string> See support of file systemflags. Default:'a'.
- Returns: <Promise>
Asynchronously append data to a file, creating the file if it does not yet
exist. data can be a string or a Buffer. The Promise will be
resolved with no arguments upon success.
If options is a string, then it specifies the encoding.
The path may be specified as a FileHandle that has been opened
for appending (using fsPromises.open()).