This repository has been archived by the owner on Mar 16, 2019. It is now read-only.
This repository has been archived by the owner on Mar 16, 2019. It is now read-only.
Downloading using download manager, Cannot Delete the file #236
Closed
Description
On Android, I downloaded a PDF file using Download Manager...then, when I delete the file later, it reports success, but the files are not being removed from the system. I can see them in Recent Files and Download History.
RNFetchBlob.session('pdf').dispose().then(() => { console.log('Succeeded'); }
I also tried just deleting the file with RNFetchBlob.fs.unlink, and it also reports Succeeded, but the file is still there. How do I really delete the files?
Activity
wkh237 commentedon Jan 25, 2017
@drblmb , files created by download manager should be scanned again using fs.scanFile so that it removed from Android media database.
drblmb commentedon Jan 28, 2017
@wkh237 , can you give me an example of this? The examples of using scanFile show it resolving a promise that returns no values.
.then((res) => RNFetchBlob.fs.scanFile([ { path : res.path(), mime : 'audio/mpeg' } ]))
.then(() => {
// scan file success
})
.catch((err) => {
// scan file error
})
In my case, I was downloading using DownloadManager which returns a path. What does scanFile do?
Thanks!
drblmb commentedon Mar 30, 2017
@wkh237, or anyone please, can someone show me how to delete a file I've downloaded with download manager?
wkh237 commentedon Mar 31, 2017
@drblmb , from my understanding if you're going to remove a file downloaded by Android Download Manager, you need to do these 2 things :
drblmb commentedon Apr 14, 2017
fs.unlink says it worked, but then after I close my app, I'm able to go to download manager and still open the file. It isn't really deleted, so this issue cannot be closed yet
rolldone commentedon Apr 15, 2017
me too, unlink does not working..
wkh237 commentedon Apr 15, 2017
Okay, just closed it due to there's no response. Reopen this one.
Add exception handling when file does not removed correctly #236
Add error handling to Android download manager when file not download…
5 remaining items