Skip to content
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
@drblmb

Description

@drblmb

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

wkh237 commented on Jan 25, 2017

@wkh237
Owner

@drblmb , files created by download manager should be scanned again using fs.scanFile so that it removed from Android media database.

drblmb

drblmb commented on Jan 28, 2017

@drblmb
Author

@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

drblmb commented on Mar 30, 2017

@drblmb
Author

@wkh237, or anyone please, can someone show me how to delete a file I've downloaded with download manager?

wkh237

wkh237 commented on Mar 31, 2017

@wkh237
Owner

@drblmb , from my understanding if you're going to remove a file downloaded by Android Download Manager, you need to do these 2 things :

  1. remove the file using fs.unlink
  2. scan the path again (fs.scanFile)
drblmb

drblmb commented on Apr 14, 2017

@drblmb
Author

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

rolldone commented on Apr 15, 2017

@rolldone

me too, unlink does not working..

reopened this on Apr 15, 2017
wkh237

wkh237 commented on Apr 15, 2017

@wkh237
Owner

Okay, just closed it due to there's no response. Reopen this one.

5 remaining items

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Downloading using download manager, Cannot Delete the file · Issue #236 · wkh237/react-native-fetch-blob