fsPromises.appendFile(path, data[, options])
-
path<string> | <Buffer> | <URL> | <FileHandle> 文件名或 <FileHandle>¥
path<string> | <Buffer> | <URL> | <FileHandle> filename or <FileHandle> -
-
mode<integer> 默认值:0o666¥
mode<integer> Default:0o666 -
flag<string> 参见 支持文件系统flags。默认值:'a'。¥
flag<string> See support of file systemflags. Default:'a'. -
flush<boolean> 如果是true,则在关闭基础文件描述符之前将其刷新。默认值:false。¥
flush<boolean> Iftrue, the underlying file descriptor is flushed prior to closing it. Default:false.
-
返回:<Promise> 成功时将使用
undefined履行。¥Returns: <Promise> Fulfills with
undefinedupon success.
异步地将数据追加到文件,如果该文件尚不存在,则创建该文件。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 指定为已打开用于追加(使用 fsPromises.open())的 <FileHandle>。
¥The path may be specified as a <FileHandle> that has been opened
for appending (using fsPromises.open()).