Please provide the following:
- SDK Version: 36.0.0
- Platform: iOS Simulator
I need to copy a .db
file from assets to the FileSystem.documentDirectory
but I get an error. Here’s the code I’m trying:
await FileSystem.downloadAsync(
Asset.fromModule(require('../assets/databases/data.db')).uri,
`${FileSystem.documentDirectory}SQLite/data.db`
);
Here’s the error I get:
Unable to resolve module "../assets/databases/data.db"
None of these files exist:
* assets/databases/data.db(.native|.ios.expo.ts|.native.expo.tx|.expo.ts|.ios.expo.tsx|.native.expo.tsx|.expo.tsx|.ios.expo.js|.native.expo.js|.expo.js|.ios.expo.jsx|.native.expo.jsx|.expo.jsx|.ios.ts|.native.ts|.ts|.ios.tsx|.native.tsx|.tsx|.ios.js|.native.js|.js|.ios.jsx|.native.jsx|.jsx|.ios.json|.native.json|.json|.ios.wasm|.native.wasm|.wasm)
How do i copy a .db
file from assets to the FileSystem.documentDirectory
folder? I just need to copy a .db
file from assets to the FileSystem.documentDirectory
folder, but this error makes it look like Asset.fromModule
only allows image files.
If I use the exact same code but replace the .db
file with a .png
file, it works.