Skip to main content

Function: handleSQLiteBackupDownload()

handleSQLiteBackupDownload(downloadFunction: () => Promise<Uint8Array<ArrayBufferLike>>): Promise<void>

Defined in: src/stores/sites/utils/fileDownload.ts:255

Handles downloading SQLite backup data as a file.

Parametersโ€‹

downloadFunctionโ€‹

() => Promise<Uint8Array<ArrayBufferLike>>

An async function that returns the backup data as a Uint8Array

Returnsโ€‹

Promise<void>

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 is not a Uint8Array

Throwsโ€‹

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global\_Objects/Error if the download fails due to browser API or DOM errors