0

我正在尝试从 Android 下载目录中删除一些文件。我获得了外部存储的 android 权限,所以这是我的代码:

var RNFS = require('react-native-fs');

...

await RNFS.exists(filepath).then((exists) => {
  if (exists) {
      RNFS.unlink(filepath).then(() => {
         RNFS.scanFile(filepath);
      })
   }
});

当我在其中添加一些日志时,取消链接功能可以完美运行。它没有catch(),但是当我再次启动相同的脚本时,取消链接仍然有效,而必须删除文件,这怎么可能?

我不明白我必须做什么才能完全删除这些文件......

编辑 :

我检查了react-native-fs它,它说:

Android support is currently limited to only the DocumentDirectory. This maps to the app's files directory.

那么如何删除下载目录中的文件呢?

4

0 回答 0