diff --git a/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt b/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt index 5f36b625..6179cfc7 100644 --- a/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt +++ b/android/src/main/java/com/op/sqlite/OPSQLiteModule.kt @@ -59,10 +59,7 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB val assetsManager = context.assets try { - // Open the input stream for the asset file - val inputStream: InputStream = assetsManager.open("$path/$filename") - // Create the output file in the documents directory val databasesFolder = context.getDatabasePath("defaultDatabase") .absolutePath @@ -79,6 +76,8 @@ internal class OPSQLiteModule(context: ReactApplicationContext?) : ReactContextB } } + val inputStream: InputStream = assetsManager.open("$path/$filename") + // Open the output stream for the output file val outputStream: OutputStream = FileOutputStream(outputFile) diff --git a/src/index.ts b/src/index.ts index 055bdc1b..eac68a6d 100644 --- a/src/index.ts +++ b/src/index.ts @@ -489,11 +489,11 @@ export const open = (options: { }; }; -export const moveAssetsDatabase = (args: { +export const moveAssetsDatabase = async (args: { filename: string; path?: string; overwrite?: boolean; -}): boolean => { +}): Promise => { return NativeModules.OPSQLite.moveAssetsDatabase(args); };