Answer the question
In order to leave comments, you need to log in
What is the best way to open downloaded React Native Expo file?
I don’t know, unfortunately or fortunately, but for now we use Expo
And it is advisable not to cut it out yet.
I'm trying to implement a function to open a file that was downloaded through this function.
const downloadFile = async (url) => {
let path = url.split('/');
const file_name = path[path.length - 1];
FileSystem.downloadAsync(url, FileSystem.documentDirectory + file_name)
.then(({ uri }) => {
console.log('Finished downloading to ', uri);
setSystemUri(uri);
MediaLibrary.createAssetAsync(uri).then((asset) => {
//console.log('asset', asset);
MediaLibrary.createAlbumAsync('MyFolder', asset)
.then((asset) => {
//alert('Success download');
//console.log(asset)
})
.catch((error) => {});
});
})
.catch((error) => {
console.error(error);
});
};
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question