Skip to main content

Function: uploadBackupWithMetadata()

uploadBackupWithMetadata(args: { backupsPrefix: string; buffer: Buffer; deleteObject?: (key: string) => Promise<unknown>; encrypted: boolean; fileName: string; metadata: SerializedDatabaseBackupMetadata; uploadObject: (args: { buffer: Buffer; key: string; overwrite?: boolean; }) => Promise<unknown>; }): Promise<CloudBackupEntry>

Defined in: electron/services/cloud/providers/cloudBackupIo.ts:36

Uploads a backup blob and its .metadata.json sidecar.

Parameters

args

Upload parameters.

backupsPrefix

string

Provider-specific backups key prefix (typically backups/).

buffer

Buffer

Raw SQLite backup bytes (encrypted or plaintext).

deleteObject?

(key: string) => Promise<unknown>

Optional provider delete primitive.

Remarks

Used for best-effort cleanup if the metadata sidecar upload fails after uploading the backup bytes.

encrypted

boolean

Indicates whether the stored backup is encrypted.

fileName

string

User-facing file name used as the backup object name.

metadata

SerializedDatabaseBackupMetadata

Metadata describing the backup.

uploadObject

(args: { buffer: Buffer; key: string; overwrite?: boolean; }) => Promise<unknown>

Provider upload primitive. Must accept POSIX-style keys.

Returns

Promise<CloudBackupEntry>

The CloudBackupEntry describing the uploaded backup.

Remarks

This helper enforces the canonical backup storage layout:

  • Backup object at ${backupsPrefix}${fileName}
  • Sidecar metadata at ${backupKey}.metadata.json