Standalone function to make a backup of a database.
This function matches the Node.js node:sqlite module API which exports
backup() as a standalone function in addition to the db.backup() method.
The database to backup from.
The path where the backup will be created.
Optionaloptions: BackupOptions
Optional configuration for the backup operation.
A promise that resolves when the backup is completed.
import { DatabaseSync, backup } from '@photostructure/sqlite';
const db = new DatabaseSync('./source.db');
await backup(db, './backup.db');
// With options
await backup(db, './backup.db', {
rate: 10,
progress: ({ totalPages, remainingPages }) => {
console.log(`Progress: ${totalPages - remainingPages}/${totalPages}`);
}
});
SQLite constants for various operations and flags.
node:sqlite)The Database class represents a synchronous connection to a SQLite database. All operations are performed synchronously, blocking until completion.
The pre-rename name of SqliteModule.Database, kept as an alias. Node.js deprecates it in documentation only (DEP0210).
The Session class for recording database changes. This class should not be instantiated directly; use Database.createSession() instead.
The Statement class represents a synchronous prepared statement. This class should not be instantiated directly; use Database.prepare() instead.
The pre-rename name of SqliteModule.Statement, kept as an alias. Node.js deprecates it in documentation only (DEP0211).
The main SQLite module interface.