[英]NativeScript Downloader plugin: Can not open zip file after downloading the file
我正在使用本機腳本 8 並使用ns 插件添加 @triniwiz/nativescript-downloader插件從服務器下載 zip 文件。
我收到下載響應
"status": "completed",
"path": "file:///data/user/0/com.myapp.example/cache/1bbf6484-9c77-4357-9759-1c1a55011a21"
但是當插件試圖解壓縮相同的下載文件時,它給了我這個
File does not exist, invalid archive path: file:///data/user/0/com.myapp.example/cache/1bbf6484-9c77-4357-9759-1c1a55011a21
我正在使用@nativescript/zip 來解壓縮下載的文件。
unZipFile(path, unzipPath) {
let destination = fs.path.join(this.document.path,"/assets/",unzipPath);
return Zip.unzip({
archive: path,
directory: destination,
onProgress: this.onUnZipProgress
}).then((res) => {
console.log(res);
return destination;
}).catch((err) => {
return 'failed-----------------:'+err;
});
}
不確定代碼或插件是否有問題,有人可以幫忙嗎?
檢查您正在使用的下載目錄。 您可能應該只使用 temp 或 documents 已知文件夾。 有關詳細信息,請參閱 [NativeScript 文件系統][1] 文檔。
我見過一個類似的問題,看起來文件下載成功但實際上由於安全限制而失敗。 在 iOS 上尤其如此。
[1]: https://v7.docs.nativescript.org/ns-framework-modules/file-system
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.