{"id":46445,"library":"sqlite-backup","title":"sqlite-backup","description":"SQLite backup helper for Expo and React Native. Current version 0.2.1. Provides SQLite database backup and restore functionality as an Expo module, integrating with expo-sqlite. Releases track Expo SDK versions; peer-dep requires expo ^51.0.32. Key differentiator: native backup/restore via expo modules, not pure JS. Supports managed Expo workflows and bare React Native. TypeScript types included.","status":"active","version":"0.2.1","language":"javascript","source_language":"en","source_url":"https://github.com/shahidhelalkhan/sqlite-backup","tags":["javascript","react-native","expo","sqlite-backup","SqliteBackup","typescript"],"install":[{"cmd":"npm install sqlite-backup","lang":"bash","label":"npm"},{"cmd":"yarn add sqlite-backup","lang":"bash","label":"yarn"},{"cmd":"pnpm add sqlite-backup","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Peer dependency required for Expo module runtime.","package":"expo","optional":false},{"reason":"Peer dependency for React Native.","package":"react","optional":false},{"reason":"Peer dependency for React Native.","package":"react-native","optional":false}],"imports":[{"note":"The module is ESM-only; CommonJS require may not work in all bundlers.","wrong":"const SqliteBackup = require('sqlite-backup');","symbol":"SqliteBackup","correct":"import * as SqliteBackup from 'sqlite-backup';"},{"note":"Function exported directly from the package.","wrong":"import { backupDatabaseAsync } from 'expo-sqlite-backup';","symbol":"backupDatabaseAsync","correct":"import { backupDatabaseAsync } from 'sqlite-backup';"},{"note":"Ensure correct package name; mistaking the package name is common.","wrong":"import { restoreDatabaseAsync } from 'expo-sqlite-backup';","symbol":"restoreDatabaseAsync","correct":"import { restoreDatabaseAsync } from 'sqlite-backup';"},{"note":"This is a TypeScript type, not runtime value; use import type.","wrong":"import { SqliteBackupOptions } from 'sqlite-backup';","symbol":"SqliteBackupOptions","correct":"import type { SqliteBackupOptions } from 'sqlite-backup';"}],"quickstart":{"code":"import * as SQLite from 'expo-sqlite';\nimport * as SqliteBackup from 'sqlite-backup';\n\nasync function backupDatabase() {\n  const dbName = 'myDatabase.db';\n  const backupName = 'myDatabase_backup.db';\n  try {\n    await SqliteBackup.backupDatabaseAsync(dbName, backupName);\n    console.log('Backup successful');\n  } catch (error) {\n    console.error('Backup failed:', error);\n  }\n}\n\nasync function restoreDatabase() {\n  const dbName = 'myDatabase.db';\n  const backupName = 'myDatabase_backup.db';\n  try {\n    await SqliteBackup.restoreDatabaseAsync(dbName, backupName);\n    console.log('Restore successful');\n  } catch (error) {\n    console.error('Restore failed:', error);\n  }\n}\n\n// Usage\nbackupDatabase();\nrestoreDatabase();","lang":"typescript","description":"Shows basic backup and restore operations using sqlite-backup with expo-sqlite."},"warnings":[{"fix":"Ensure database is stored on disk when using backup/restore functions.","message":"Does not work with in-memory databases; only persistent SQLite databases.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pass database name (string) as first argument instead of database object.","message":"API changed from version 0.1.x to 0.2.0: backupDatabaseAsync and restoreDatabaseAsync now require database names, not database objects.","severity":"breaking","affected_versions":">=0.2.0"},{"fix":"Use backupDatabaseAsync and restoreDatabaseAsync instead.","message":"backupDatabase and restoreDatabase (without Async suffix) are deprecated since 0.2.0.","severity":"deprecated","affected_versions":">=0.2.0"},{"fix":"Always use absolute paths or rely on default directory returned by expo-file-system.","message":"Database backup directory may differ between iOS and Android; path resolution issues common.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'0.2.1':14 '51.0.32':41 'backup':3,5,18,70 'backup/restore':45 'bare':57 'current':12 'databas':17 'dep':38 'differenti':43 'expo':8,24,29,33,40,47,54,67 'expo-sqlit':28 'function':21 'helper':6 'includ':62 'integr':26 'javascript':63 'js':51 'key':42 'manag':53 'modul':25,48 'nativ':11,44,59,66 'peer':37 'peer-dep':36 'provid':15 'pure':50 'react':10,58,65 'react-nat':64 'releas':31 'requir':39 'restor':20 'sdk':34 'sqlite':2,4,16,30,69 'sqlite-backup':1,68 'sqlitebackup':71 'support':52 'track':32 'type':61 'typescript':60,72 'version':13,35 'via':46 'workflow':55","created_at":"2026-06-07T12:59:58.023740+00:00","updated_at":"2026-06-07T12:59:58.023740+00:00","problems":[{"fix":"Run 'npm install sqlite-backup expo-sqlite' and ensure Expo SDK >= 51.","cause":"Missing npm install or unmet peer dependencies.","error":"Cannot find module 'sqlite-backup' or its corresponding type declarations."},{"fix":"Use 'import * as SqliteBackup from \"sqlite-backup\";' and call SqliteBackup.backupDatabaseAsync(...).","cause":"Importing from wrong package or incorrect export name.","error":"TypeError: (0 , _sqliteBackup.backupDatabaseAsync) is not a function"},{"fix":"Use Platform.OS to conditionally call backup/restore only on iOS/Android.","cause":"Attempting to use backup on a platform that doesn't support native modules (e.g., web).","error":"Error: backupDatabaseAsync is not available in managed workflow"},{"fix":"Use 'import * as SqliteBackup from \"sqlite-backup\";' instead of default import.","cause":"Importing the module incorrectly (e.g., default import instead of namespace).","error":"SqliteBackup.backupDatabaseAsync is not a function (In 'SqliteBackup.backupDatabaseAsync(dbName, backupName)', 'SqliteBackup.backupDatabaseAsync' is undefined)"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/shahidhelalkhan/sqlite-backup#readme","github":"https://github.com/shahidhelalkhan/sqlite-backup","docs":null,"changelog":null,"pypi":null,"npm":"sqlite-backup","openapi_spec":null,"status_page":null,"smithery":null,"categories":["database"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}