# FileSystemManager.appendFileSync

在文件结尾追加内容(同步调用)。

# 支持说明

应用能力 Android iOS PC 预览效果
小程序 3.12.0 3.11.0 3.10.0
扫码预览
用BoosHi扫码或PC端点击
网页应用 待开发 待开发 待开发 待补充

# 输入

名称 数据类型 必填 默认值 描述
filePath string 本地文件路径
data string/ArrayBuffer 要写入的文本或二进制数据
encoding string utf8 指定写入文件的字符编码,默认值仅在data为string类型时生效

# encoding 的合法值

说明 Android iOS
ascii 支持 支持
base64 支持 支持
binary 支持 支持
hex 支持 支持
ucs2/ucs-2/utf16le/utf-16le 以小端序读取 支持 支持
utf-8/utf8 支持 支持
latin1 支持 支持

# 输出

继承标准对象输出,无扩展属性

# 代码示例

const fileSystemManager = bz.getFileSystemManager();

const filePath = `bzfile://user/example.txt`;

const res = fileSystemManager.appendFileSync(filePath, "example append content", "utf8")
if (!res.errCode) {
  console.log("调用成功");
} else {
  console.log("调用失败", res.errMsg);
}
1
2
3
4
5
6
7
8
9
10
最后更新于 : 5/18/2023, 3:09:13 PM