我有以下代码可以从我创建的下载文件夹中取消链接/删除文件,也可以使用相同的路径通过应用程序创建。
注意我使用的是 RNFetchBlob 包。
---
const fs = RNFetchBlob.fs
const base64 = RNFetchBlob.base64
const dirs = RNFetchBlob.fs.dirs
RNFetchBlob.fs
.unlink(dirs.DownloadDir + '/passpoint.config.xml')
.then(() => {
alert("File deleted");
})
.catch(err => {
alert(err);
});
---
我不断收到以下错误;
[Error: Failed to delete '/storage/emulated/0/Download/passpoint.config.xml']
我认为它可能是路径,但这与我用来创建文件的路径相同,我可以通过 Android 上的文件资源管理器查看该文件。
解决方案
fs.unlink(dirs.DownloadDir + '/passpoint.config.xml');