先下载这个文件到本地
const cachePath = '_doc/project/lix_indoor.las';
const task = plus.downloader.createDownload(
'http://192.168.31.79:8080/lix_indoor.las',
{
filename: cachePath
},
(d, status) => {
// 下载完成
if (status == 200) {
console.log('Download success: ' + d.filename);
} else {
console.log('Download failed: ' + status);
}
}
);
task.start();
再把这个文件转成remoteurl
plus.io.resolveLocalFileSystemURL(
cachePath,
(entry) => {
this.fileUrl = entry.toRemoteURL();
console.log(this.fileUrl);
},
(e) => {
this.message.alert('Resolve file URL failed: ' + e.message);
}
);
在renderjs 使用fetch请求这个文件
fetch(this.fileUrl)
端水大师 (作者)
内存肯定爆了,但是这就是个bug,http返回文件,不需要一次分配这么多内存,我自己已经写了一个原生http插件,解决了这个问题,官网这个就是大文件不行
2025-05-04 12:55