Function: handleSQLiteBackupDownload()
function handleSQLiteBackupDownload(
downloadFunction: () => Promise<SerializedDatabaseBackupResult>
): Promise<SerializedDatabaseBackupResult>;
Defined in: src/stores/sites/utils/fileDownload.ts:122
Handles downloading SQLite backup data as a file.
Parametersโ
downloadFunctionโ
() => Promise<SerializedDatabaseBackupResult>
Async function resolving to a serialized backup payload from the Electron main process.
Returnsโ
Promise<SerializedDatabaseBackupResult>
Remarksโ
This function retrieves backup data using the provided function, validates it, and triggers a browser download. The download is performed using a Blob and anchor element with proper object URL lifecycle management.
Exampleโ
await handleSQLiteBackupDownload(() => fetchBackupData());
Throwsโ
TypeError if the backup data fails validation.
Throwsโ
Error if the download fails due to browser API or DOM errors.