Please provide the following:
- SDK Version: 41.0.0
- Platforms(Android/iOS/web/all): Android 10
- Add the appropriate “Tag” based on what Expo library you have a question on.
Running the example code on: FileSystem - Expo Documentation and selecting the default downloads folder yields an error
The error:
[Unhandled promise rejection: Error: The URI 'content://com.android.providers.downloads.documents/tree/downloads' is not a Storage Access Framework URI. Try using FileSystem.readDirectoryAsync instead.]
The code:
import { StorageAccessFramework } from 'expo-file-system';
// Requests permissions for external directory
const permissions = await StorageAccessFramework.requestDirectoryPermissionsAsync();
if (permissions.granted) {
// Gets SAF URI from response
const uri = permissions.directoryUri;
// Gets all files inside of selected directory
const files = await StorageAccessFramework.readDirectoryAsync(uri);
alert(`Files inside ${uri}:\n\n${JSON.stringify(files)}`);
}