Open dowloaded files / External storage

Is it possible to open a downloaded file?

let remoteUrl = 'http://...';
let localPath = `${FileSystem.documentDirectory}myDirectory/myFile`;

FileSystem.downloadAsync(remoteUrl, localPath)
   .then(({uri}) => Linking.openURL(uri));

Expo.FileSystem gives the option to save the download in the internal storage (FileSystem.documentDirectory) but in this way Linking.openURL(uri) (for example) doesn’t have permissions/access.

I have tried the react-native-fs package since it has the constants RNFS.ExternalDirectoryPath and RNFS.ExternalStorageDirectoryPath but this package doesn’t seem compatible with Expo/CRNA.

Has anyone encountered the same situation? How did you focus it?

Thanks bros!

2 Likes

This topic was automatically closed 15 days after the last reply. New replies are no longer allowed.