You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
636 B
18 lines
636 B
import { DatabaseBackupService } from "../../DatabaseBackupService";
|
|
import { dialog } from "electron";
|
|
import * as fs from "fs";
|
|
import * as path from "path";
|
|
|
|
export default class ElectronDatabaseBackupService extends DatabaseBackupService {
|
|
protected async handleBackup(base64Data: string): Promise<void> {
|
|
const { filePath } = await dialog.showSaveDialog({
|
|
title: "Save Database Backup",
|
|
defaultPath: path.join(process.env.HOME || "", "database-backup.json"),
|
|
filters: [{ name: "JSON", extensions: ["json"] }],
|
|
});
|
|
|
|
if (filePath) {
|
|
fs.writeFileSync(filePath, base64Data, "base64");
|
|
}
|
|
}
|
|
}
|
|
|