How do I save a file to the Dwonload folder on my Android device using Expo?

51 Views Asked by At

my solution:

 const permissions = await FileSystem.StorageAccessFramework.requestDirectoryPermissionsAsync()
                    if (permissions.granted) {
                        await FileSystem.StorageAccessFramework.createFileAsync(permissions.directoryUri, fileName, 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet')
                        .then(async (uri) => {
                                await FileSystem.writeAsStringAsync(uri, fileData, { encoding: FileSystem.EncodingType.Base64 })
                            }
                        )
                        .catch(error => Alert.alert("error", "Sorry, we can't upload to this folder! Please choose another folder! "))
                        
                    }

But I need to save the file without await FileSystem.StorageAccessFramework.requestDirectoryPermissionsAsync() because it's not user friendly

0

There are 0 best solutions below