lisk-framework
Version:
Lisk blockchain application platform
18 lines • 634 B
JavaScript
Object.defineProperty(exports, "__esModule", { value: true });
exports.backupDatabase = void 0;
const path = require("path");
const fs = require("fs");
const backupDatabase = async (dataPath, dbName, db) => {
const backupDir = path.resolve(dataPath, 'backup');
const backupPath = path.resolve(backupDir, dbName);
if (fs.existsSync(backupPath)) {
fs.rmSync(backupPath, { recursive: true, force: true });
}
if (!fs.existsSync(backupDir)) {
fs.mkdirSync(backupDir);
}
await db.checkpoint(backupPath);
};
exports.backupDatabase = backupDatabase;
//# sourceMappingURL=backup.js.map
;