Search code examples
typescriptreact-nativeexpoexpo-go

How to access expo-file-system Filesystem.documentDirectory


I am trying to do a data backup for my React Native App with expo go and expo-file-system

 await Filesystem.writeAsStringAsync(
   Filesystem.documentDirectory! + "GymTracker-Data.json",
   JSON.stringify(exportData)
 )

How do I access this documentDirectory with a file explorer app like File Manager or Amaze File Manager?

I tried printing out the path on the app but I can't find said path.


Solution

  • documentDirectory is your app's private internal directory, only accessible by your app. Third party apps like File Manager cannot access it.

    At the moment, expo does not provide any API to write files to 'download' or other public directories. But this may change in future. Check these two posts discussing the issue.

    https://forums.expo.dev/t/how-to-save-the-file-to-devices-folder-like-download/2398 https://expo.canny.io/feature-requests/p/ability-to-save-files-on-internal-storage