kesha-antonov / react-native-background-downloader

About A library for React-Native to help you download large files on iOS and Android both in the foreground and most importantly in the background.
https://www.npmjs.com/package/@kesha-antonov/react-native-background-downloader
Other
26 stars 3 forks source link

Question: RNBackgroundDownloader.directories.documents returns invalid directory path on Android #10

Open mtshv opened 1 month ago

mtshv commented 1 month ago

Hi there,

I've encountered an issue with RNBackgroundDownloader.directories.documents on Android:

On iOS, the output of both RNBackgroundDownloader.directories.documents and FileSystem.documentDirectory are identical.

Does this mean that we cannot rely on RNBackgroundDownloader.directories.documents on Android?

Any insights or suggestions would be greatly appreciated.

Thank you!

vSyrotkinRelevant commented 2 weeks ago

Hey there, Have you found the correct path for that? Pls tell me how you managed that issue.

mtshv commented 2 weeks ago

@vSyrotkinRelevant for now, I am using

import * as FileSystem from 'expo-file-system';
const downloadPath = FileSystem.documentDirectory

As this approach returns the existing directory for both ios and android, I think you can achieve the same with other filesystem libraries for React Native.

I haven't tested this extensively yet, so I can't guarantee that it's the ultimate solution. But this is what I have for the moment

P.S. Still very curious about the RNBackgroundDownloader.directories.documents issue that I am seeing. And wonder what users of this package are using for download directories on Android. Perhaps @kesha-antonov could shed some light