MCPcopy Create free account
hub / github.com/Criptext/Criptext-Email-React-Client / copyDatabase

Function copyDatabase

electron_app/src/backup/FileUtils.js:38–60  ·  view source on GitHub ↗
(dbPath, tempBackupDirectory)

Source from the content-addressed store, hash-verified

36};
37
38const copyDatabase = (dbPath, tempBackupDirectory) => {
39 const dbshm = `${dbPath}-shm`;
40 const dbwal = `${dbPath}-wal`;
41
42 if (!fs.existsSync(dbPath)) {
43 throw new Error('No Database Found');
44 }
45
46 fs.copyFileSync(dbPath, path.join(tempBackupDirectory, 'CriptextEncrypt.db'));
47
48 if (fs.existsSync(dbshm)) {
49 fs.copyFileSync(
50 dbshm,
51 path.join(tempBackupDirectory, 'CriptextEncrypt.db-shm')
52 );
53 }
54 if (fs.existsSync(dbwal)) {
55 fs.copyFileSync(
56 dbwal,
57 path.join(tempBackupDirectory, 'CriptextEncrypt.db-wal')
58 );
59 }
60};
61
62const loadJson = path => {
63 if (!fs.existsSync(path)) return {};

Callers 1

startFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected