阅读(3950) (1)

微信小游戏开发文档-小游戏文件API string FileSystemManager.readFileSync(string filePath, string encoding)

2017-12-29 14:44:42 更新

string FileSystemManager.readFileSync(string filePath, string encoding)

FileSystemManager.readFile 的同步版本

参数

string filePath

要读取的文件的路径

string encoding

指定读取文件的字符编码

encoding 的合法值

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

返回值

string errMsg

错误信息

errMsg 的合法值

说明
fail no such file or directory, open ${filePath} 指定的 filePath 所在目录不存在
fail permission denied, open ${dirPath} 指定的 filePath 路径没有读权限