Skip to content

Instantly share code, notes, and snippets.

@supersuryaansh
Created May 31, 2025 06:06
Show Gist options
  • Save supersuryaansh/5fe3e577ea77b043fa27eefc46284a5b to your computer and use it in GitHub Desktop.
Save supersuryaansh/5fe3e577ea77b043fa27eefc46284a5b to your computer and use it in GitHub Desktop.
How to create sotrage directory properly in an bare-expo app
import useBareDir from './hook'
const bareDir = await useBareDir()
worklet.start('./backend.bundle', source, [bareDir])
let path = Bare.argv[0]
if (path.includes('file://')) {
path = path.replace('file://', '')
}
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