小程序真机调试时,下载大约5MB的文件后,读取超时。试过两种方法:
方法一:FileSystemManager.readFile(Object object)
var wasmfilepath = evt.tempFilePath;
console.log(wasmfilepath)
console.log(wasmdir + wasmfilename)
var ret = FSM.saveFileSync(wasmfilepath, wasmdir + wasmfilename);
console.log(ret)
var stat = FSM.statSync(ret, false)
console.log(stat)
FSM.readFile({filePath: ret, success(res) {
console.log("read file suceed!!!")
new WebAssembly.compile(wasmdata).then(function (wam) {
new WebAssembly.instantiate(wam, info).then(receiveInstantiatedSource);
});
},
fail: console.error
});
方法二:FileSystemManager.readFile(Object object)
var wasmfilepath = evt.tempFilePath;
console.log(wasmfilepath)
console.log(wasmdir + wasmfilename)
var ret = FSM.saveFileSync(wasmfilepath, wasmdir + wasmfilename);
console.log(ret)
var stat = FSM.statSync(ret, false)
console.log(stat)
var res = FSM.readFileSync(ret)
new WebAssembly.compile(res).then(function (wam) {
new WebAssembly.instantiate(wam, info).then(receiveInstantiatedSource);
});
模拟器调试同样的代码,没有问题。
有解决方案吗?我用微信的图片选择器返回的url,真机调试出错readFileSync:fail timeout,机型华为P20pro
我也遇到了同样的问题,真机调试。使用FSM.readFileSync读微信好友里的pdf文件出错。
Unhandled promise rejection Error: readFileSync:fail timeout
at l (eval at n.call.document (runtime.js?devtools_ignore=true:1), <anonymous>:2:1964570)
at Object.A.<computed> (eval at n.call.document (runtime.js?devtools_ignore=true:1), <anonymous>:2:1855963)
at Object.l.<computed> [as readFileSync] (eval at n.call.document (runtime.js?devtools_ignore=true:1), <anonymous>:2:1939342)
我用的是iphone 6s plus。求解决办法。文件就2M而已。
你好,麻烦提供出现问题的具体机型、微信版本号、系统版本号,以及能复现问题的代码片段(https://developers.weixin.qq.com/miniprogram/dev/devtools/minicode.html)
机型:Huawei M20 Pro, Sony Xperia
微信版本号:7.0.17, 7.0.19
2.14.1