codecamp

FileSystemManager.readFile

FileSystemManager.readFile(Object object)

读取本地文件内容


输入

继承标准对象输入,扩展属性描述:

属性类型默认值是否必填说明
filePathstring要读取的文件的路径
encodingstring指定读取文件的字符编码,如果不传 encoding,则以 ArrayBuffer 格式读取文件的二进制内容
说明
ascii
base64
binary
hex
ucs2/ucs-2/utf16le/utf-16le以小端序读取
utf-8/utf8
latin1


输出

success 回调函数参数 Object

属性类型说明
datastring/ArrayBuffer文件内容

fail 回调函数参数 Object

属性类型说明支持版本
errMsgstring错误信息
说明
fail no such file or directory, open ${filePath}指定的 filePath 所在目录不存在
fail permission denied, open ${dirPath}指定的 filePath 路径没有读权限


FileSystemManager.mkdirSync
FileSystemManager.readFileSync
温馨提示
下载编程狮App,免费阅读超1000+编程语言教程
取消
确定
目录

无标题目录

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题文章

无标题目录

无标题文章

关闭

MIP.setData({ 'pageTheme' : getCookie('pageTheme') || {'day':true, 'night':false}, 'pageFontSize' : getCookie('pageFontSize') || 20 }); MIP.watch('pageTheme', function(newValue){ setCookie('pageTheme', JSON.stringify(newValue)) }); MIP.watch('pageFontSize', function(newValue){ setCookie('pageFontSize', newValue) }); function setCookie(name, value){ var days = 1; var exp = new Date(); exp.setTime(exp.getTime() + days*24*60*60*1000); document.cookie = name + '=' + value + ';expires=' + exp.toUTCString(); } function getCookie(name){ var reg = new RegExp('(^| )' + name + '=([^;]*)(;|$)'); return document.cookie.match(reg) ? JSON.parse(document.cookie.match(reg)[2]) : null; }