@photostructure/sqlite
    Preparing search index...

    Variable backupConst

    backup: (
        sourceDb: DatabaseSyncInstance,
        destination: string | Buffer | URL,
        options?: BackupOptions,
    ) => Promise<number> = binding.backup

    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.

    Type Declaration

      • (
            sourceDb: DatabaseSyncInstance,
            destination: string | Buffer | URL,
            options?: BackupOptions,
        ): Promise<number>
      • Parameters

        • sourceDb: DatabaseSyncInstance

          The database to backup from.

        • destination: string | Buffer | URL

          The path where the backup will be created.

        • Optionaloptions: BackupOptions

          Optional configuration for the backup operation.

        Returns Promise<number>

        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}`);
    }
    });