Skip to main content

Directory Picker

This module allows you to pick a directory from the file system. The chosen directory can then be used for file I/O operations.

When requestLongTermAccess is set to true, your app will be able to access the directory even after the app is closed and reopened.

If you've requested long-term access to a directory or file, the response object will contain BookmarkingResponse.

Please note there are some security limitations.

Selecting a directory
import { pickDirectory } from '@react-native-documents/picker'

return (
<Button
title="open directory"
onPress={async () => {
try {
const { uri } = await pickDirectory({
requestLongTermAccess: false,
})
// do something with the uri
} catch (err) {
// see error handling section
console.error(err)
}
}}
/>
)

How it works

Open mode uses Intent.ACTION_OPEN_DOCUMENT_TREE internally.