Storage Access Framework does not work as intended

Please provide the following:

  1. SDK Version: 41.0.0
  2. Platforms(Android/iOS/web/all): Android 10
  3. 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://' 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)}`);

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