React Native RNFS delete file from download directory

4k views Asked by At

I'm trying to delete some files from the Android Download Directory. I got the android permission to the external storage to do it, so this is my code :

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

...

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

The unlink function works perfectly when I add some log in it. It doesn't catch(), but when I launch the same script again, the unlink still works while the file must be deleted, how is it possible ??

I don't understand what I have to do to completely delete these files...

EDIT :

I've checked the react-native-fs and it says :

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

So how can I delete files in the Download directory ?

0

There are 0 answers