Created
May 31, 2025 06:06
-
-
Save supersuryaansh/5fe3e577ea77b043fa27eefc46284a5b to your computer and use it in GitHub Desktop.
How to create sotrage directory properly in an bare-expo app
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import useBareDir from './hook' | |
const bareDir = await useBareDir() | |
worklet.start('./backend.bundle', source, [bareDir]) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
let path = Bare.argv[0] | |
if (path.includes('file://')) { | |
path = path.replace('file://', '') | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import * as FileSystem from 'expo-file-system' | |
const useBareDirectory = async () => { | |
const bareDir = FileSystem.documentDirectory + 'bare-doctor' | |
try { | |
await FileSystem.makeDirectoryAsync(bareDir, { intermediates: true }) | |
console.log('Directory created:', bareDir) | |
return bareDir.replace('file://', '') // Remove the URI prefix for compatibility with Bare | |
} catch (error) { | |
console.error('Error creating directory:', error) | |
throw error | |
} | |
} | |
export default useBareDirectory |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment