2023-07-08 21:40:49 +02:00
|
|
|
const sqlite3 = require('sqlite3')
|
2021-10-09 00:30:20 +02:00
|
|
|
const Path = require('path')
|
2022-11-24 22:53:58 +01:00
|
|
|
const Logger = require('../Logger')
|
|
|
|
const SocketAuthority = require('../SocketAuthority')
|
2023-07-08 21:40:49 +02:00
|
|
|
const Database = require('../Database')
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2022-06-08 03:04:51 +02:00
|
|
|
const cron = require('../libs/nodeCron')
|
2022-07-06 02:53:01 +02:00
|
|
|
const fs = require('../libs/fsExtra')
|
2022-07-07 03:12:14 +02:00
|
|
|
const archiver = require('../libs/archiver')
|
2022-07-06 02:24:16 +02:00
|
|
|
const StreamZip = require('../libs/nodeStreamZip')
|
2023-08-06 10:05:53 +02:00
|
|
|
const fileUtils = require('../utils/fileUtils')
|
2021-10-09 00:30:20 +02:00
|
|
|
|
|
|
|
// Utils
|
2022-03-20 22:41:06 +01:00
|
|
|
const { getFileSize } = require('../utils/fileUtils')
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2022-03-20 22:41:06 +01:00
|
|
|
const Backup = require('../objects/Backup')
|
2021-10-09 00:30:20 +02:00
|
|
|
|
|
|
|
class BackupManager {
|
2023-07-08 21:40:49 +02:00
|
|
|
constructor() {
|
2022-02-27 20:47:52 +01:00
|
|
|
this.BackupPath = Path.join(global.MetadataPath, 'backups')
|
2022-03-19 16:13:10 +01:00
|
|
|
this.ItemsMetadataPath = Path.join(global.MetadataPath, 'items')
|
2022-08-20 22:10:31 +02:00
|
|
|
this.AuthorsMetadataPath = Path.join(global.MetadataPath, 'authors')
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2021-10-09 18:09:06 +02:00
|
|
|
this.scheduleTask = null
|
|
|
|
|
2021-10-09 00:30:20 +02:00
|
|
|
this.backups = []
|
|
|
|
}
|
|
|
|
|
2023-09-20 23:33:58 +02:00
|
|
|
get backupLocation() {
|
|
|
|
return this.BackupPath
|
|
|
|
}
|
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
get backupSchedule() {
|
|
|
|
return global.ServerSettings.backupSchedule
|
|
|
|
}
|
|
|
|
|
|
|
|
get backupsToKeep() {
|
|
|
|
return global.ServerSettings.backupsToKeep || 2
|
|
|
|
}
|
|
|
|
|
|
|
|
get maxBackupSize() {
|
|
|
|
return global.ServerSettings.maxBackupSize || 1
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
|
|
|
|
2021-10-09 18:09:06 +02:00
|
|
|
async init() {
|
2023-06-27 23:41:32 +02:00
|
|
|
const backupsDirExists = await fs.pathExists(this.BackupPath)
|
2021-10-09 00:30:20 +02:00
|
|
|
if (!backupsDirExists) {
|
|
|
|
await fs.ensureDir(this.BackupPath)
|
|
|
|
}
|
|
|
|
|
|
|
|
await this.loadBackups()
|
2021-10-09 18:09:06 +02:00
|
|
|
this.scheduleCron()
|
|
|
|
}
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2021-10-09 18:09:06 +02:00
|
|
|
scheduleCron() {
|
2023-07-08 21:40:49 +02:00
|
|
|
if (!this.backupSchedule) {
|
2021-10-09 00:30:20 +02:00
|
|
|
Logger.info(`[BackupManager] Auto Backups are disabled`)
|
|
|
|
return
|
|
|
|
}
|
|
|
|
try {
|
2023-07-08 21:40:49 +02:00
|
|
|
var cronSchedule = this.backupSchedule
|
2021-10-09 18:09:06 +02:00
|
|
|
this.scheduleTask = cron.schedule(cronSchedule, this.runBackup.bind(this))
|
2021-10-09 00:30:20 +02:00
|
|
|
} catch (error) {
|
2023-07-08 21:40:49 +02:00
|
|
|
Logger.error(`[BackupManager] Failed to schedule backup cron ${this.backupSchedule}`, error)
|
2021-10-09 18:09:06 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
updateCronSchedule() {
|
2023-07-08 21:40:49 +02:00
|
|
|
if (this.scheduleTask && !this.backupSchedule) {
|
2021-10-09 18:09:06 +02:00
|
|
|
Logger.info(`[BackupManager] Disabling backup schedule`)
|
2022-08-18 01:44:21 +02:00
|
|
|
if (this.scheduleTask.stop) this.scheduleTask.stop()
|
2021-10-09 18:09:06 +02:00
|
|
|
this.scheduleTask = null
|
2023-07-08 21:40:49 +02:00
|
|
|
} else if (!this.scheduleTask && this.backupSchedule) {
|
|
|
|
Logger.info(`[BackupManager] Starting backup schedule ${this.backupSchedule}`)
|
2021-10-09 18:09:06 +02:00
|
|
|
this.scheduleCron()
|
2023-07-08 21:40:49 +02:00
|
|
|
} else if (this.backupSchedule) {
|
|
|
|
Logger.info(`[BackupManager] Restarting backup schedule ${this.backupSchedule}`)
|
2022-08-18 01:44:21 +02:00
|
|
|
if (this.scheduleTask.stop) this.scheduleTask.stop()
|
2021-10-09 18:09:06 +02:00
|
|
|
this.scheduleCron()
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async uploadBackup(req, res) {
|
2023-07-08 21:40:49 +02:00
|
|
|
const backupFile = req.files.file
|
2021-10-09 00:30:20 +02:00
|
|
|
if (Path.extname(backupFile.name) !== '.audiobookshelf') {
|
|
|
|
Logger.error(`[BackupManager] Invalid backup file uploaded "${backupFile.name}"`)
|
|
|
|
return res.status(500).send('Invalid backup file')
|
|
|
|
}
|
|
|
|
|
2023-08-08 00:14:47 +02:00
|
|
|
const tempPath = Path.join(this.BackupPath, fileUtils.sanitizeFilename(backupFile.name))
|
2023-07-08 21:40:49 +02:00
|
|
|
const success = await backupFile.mv(tempPath).then(() => true).catch((error) => {
|
2021-10-09 00:30:20 +02:00
|
|
|
Logger.error('[BackupManager] Failed to move backup file', path, error)
|
|
|
|
return false
|
|
|
|
})
|
|
|
|
if (!success) {
|
|
|
|
return res.status(500).send('Failed to move backup file into backups directory')
|
|
|
|
}
|
|
|
|
|
|
|
|
const zip = new StreamZip.async({ file: tempPath })
|
2023-08-06 10:05:53 +02:00
|
|
|
let entries
|
|
|
|
try {
|
|
|
|
entries = await zip.entries()
|
2023-09-30 23:01:10 +02:00
|
|
|
} catch (error) {
|
2023-08-06 10:05:53 +02:00
|
|
|
// Not a valid zip file
|
|
|
|
Logger.error('[BackupManager] Failed to read backup file - backup might not be a valid .zip file', tempPath, error)
|
|
|
|
return res.status(400).send('Failed to read backup file - backup might not be a valid .zip file')
|
|
|
|
}
|
2023-07-08 21:40:49 +02:00
|
|
|
if (!Object.keys(entries).includes('absdatabase.sqlite')) {
|
|
|
|
Logger.error(`[BackupManager] Invalid backup with no absdatabase.sqlite file - might be a backup created on an old Audiobookshelf server.`)
|
|
|
|
return res.status(500).send('Invalid backup with no absdatabase.sqlite file - might be a backup created on an old Audiobookshelf server.')
|
|
|
|
}
|
|
|
|
|
2021-10-09 00:30:20 +02:00
|
|
|
const data = await zip.entryData('details')
|
2023-07-08 21:40:49 +02:00
|
|
|
const details = data.toString('utf8').split('\n')
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
const backup = new Backup({ details, fullPath: tempPath })
|
2022-04-14 01:51:06 +02:00
|
|
|
|
|
|
|
if (!backup.serverVersion) {
|
|
|
|
Logger.error(`[BackupManager] Invalid backup with no server version - might be a backup created before version 2.0.0`)
|
|
|
|
return res.status(500).send('Invalid backup. Might be a backup created before version 2.0.0.')
|
|
|
|
}
|
|
|
|
|
2021-10-09 00:30:20 +02:00
|
|
|
backup.fileSize = await getFileSize(backup.fullPath)
|
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
const existingBackupIndex = this.backups.findIndex(b => b.id === backup.id)
|
2021-10-09 00:30:20 +02:00
|
|
|
if (existingBackupIndex >= 0) {
|
|
|
|
Logger.warn(`[BackupManager] Backup already exists with id ${backup.id} - overwriting`)
|
|
|
|
this.backups.splice(existingBackupIndex, 1, backup)
|
|
|
|
} else {
|
|
|
|
this.backups.push(backup)
|
|
|
|
}
|
|
|
|
|
2022-11-24 20:14:29 +01:00
|
|
|
res.json({
|
|
|
|
backups: this.backups.map(b => b.toJSON())
|
|
|
|
})
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
|
|
|
|
2022-03-18 19:44:29 +01:00
|
|
|
async requestCreateBackup(res) {
|
2021-10-09 00:30:20 +02:00
|
|
|
var backupSuccess = await this.runBackup()
|
2022-11-24 20:14:29 +01:00
|
|
|
if (backupSuccess) {
|
|
|
|
res.json({
|
|
|
|
backups: this.backups.map(b => b.toJSON())
|
|
|
|
})
|
|
|
|
} else {
|
|
|
|
res.sendStatus(500)
|
|
|
|
}
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
async requestApplyBackup(backup, res) {
|
2021-10-09 00:30:20 +02:00
|
|
|
const zip = new StreamZip.async({ file: backup.fullPath })
|
2023-07-08 21:40:49 +02:00
|
|
|
|
|
|
|
const entries = await zip.entries()
|
|
|
|
if (!Object.keys(entries).includes('absdatabase.sqlite')) {
|
|
|
|
Logger.error(`[BackupManager] Cannot apply old backup ${backup.fullPath}`)
|
|
|
|
return res.status(500).send('Invalid backup file. Does not include absdatabase.sqlite. This might be from an older Audiobookshelf server.')
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
2023-07-08 21:40:49 +02:00
|
|
|
|
|
|
|
await Database.disconnect()
|
|
|
|
|
|
|
|
await zip.extract('absdatabase.sqlite', global.ConfigPath)
|
|
|
|
await zip.extract('metadata-items/', this.ItemsMetadataPath)
|
|
|
|
await zip.extract('metadata-authors/', this.AuthorsMetadataPath)
|
|
|
|
|
|
|
|
await Database.reconnect()
|
|
|
|
|
2022-11-24 22:53:58 +01:00
|
|
|
SocketAuthority.emitter('backup_applied')
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async loadBackups() {
|
|
|
|
try {
|
2023-01-08 16:11:55 +01:00
|
|
|
const filesInDir = await fs.readdir(this.BackupPath)
|
|
|
|
|
2021-10-09 00:30:20 +02:00
|
|
|
for (let i = 0; i < filesInDir.length; i++) {
|
2023-01-08 16:11:55 +01:00
|
|
|
const filename = filesInDir[i]
|
2021-10-09 00:30:20 +02:00
|
|
|
if (filename.endsWith('.audiobookshelf')) {
|
2023-01-08 16:11:55 +01:00
|
|
|
const fullFilePath = Path.join(this.BackupPath, filename)
|
2022-05-03 07:47:16 +02:00
|
|
|
|
|
|
|
let zip = null
|
|
|
|
let data = null
|
|
|
|
try {
|
|
|
|
zip = new StreamZip.async({ file: fullFilePath })
|
|
|
|
data = await zip.entryData('details')
|
|
|
|
} catch (error) {
|
2023-01-08 16:11:55 +01:00
|
|
|
Logger.error(`[BackupManager] Failed to unzip backup "${fullFilePath}"`, error)
|
|
|
|
continue
|
2022-05-03 07:47:16 +02:00
|
|
|
}
|
|
|
|
|
2023-01-08 16:11:55 +01:00
|
|
|
const details = data.toString('utf8').split('\n')
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2023-01-08 16:11:55 +01:00
|
|
|
const backup = new Backup({ details, fullPath: fullFilePath })
|
2022-04-14 01:51:06 +02:00
|
|
|
|
2023-07-14 21:20:35 +02:00
|
|
|
if (!backup.serverVersion) { // Backups before v2
|
|
|
|
Logger.error(`[BackupManager] Old unsupported backup was found "${backup.filename}"`)
|
|
|
|
} else if (!backup.key) { // Backups before sqlite migration
|
|
|
|
Logger.warn(`[BackupManager] Old unsupported backup was found "${backup.filename}" (pre sqlite migration)`)
|
2022-04-14 01:51:06 +02:00
|
|
|
}
|
|
|
|
|
2021-10-09 00:30:20 +02:00
|
|
|
backup.fileSize = await getFileSize(backup.fullPath)
|
2023-01-08 16:11:55 +01:00
|
|
|
const existingBackupWithId = this.backups.find(b => b.id === backup.id)
|
2021-10-09 00:30:20 +02:00
|
|
|
if (existingBackupWithId) {
|
|
|
|
Logger.warn(`[BackupManager] Backup already loaded with id ${backup.id} - ignoring`)
|
|
|
|
} else {
|
|
|
|
this.backups.push(backup)
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.debug(`[BackupManager] Backup found "${backup.id}"`)
|
2023-01-08 16:11:55 +01:00
|
|
|
await zip.close()
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
|
|
|
}
|
|
|
|
Logger.info(`[BackupManager] ${this.backups.length} Backups Found`)
|
|
|
|
} catch (error) {
|
|
|
|
Logger.error('[BackupManager] Failed to load backups', error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
async runBackup() {
|
2021-10-10 23:36:21 +02:00
|
|
|
// Check if Metadata Path is inside Config Path (otherwise there will be an infinite loop as the archiver tries to zip itself)
|
2021-10-09 00:30:20 +02:00
|
|
|
Logger.info(`[BackupManager] Running Backup`)
|
2023-07-08 21:40:49 +02:00
|
|
|
const newBackup = new Backup()
|
|
|
|
newBackup.setData(this.BackupPath)
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
await fs.ensureDir(this.AuthorsMetadataPath)
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
// Create backup sqlite file
|
|
|
|
const sqliteBackupPath = await this.backupSqliteDb(newBackup).catch((error) => {
|
|
|
|
Logger.error(`[BackupManager] Failed to backup sqlite db`, error)
|
|
|
|
return false
|
|
|
|
})
|
|
|
|
|
|
|
|
if (!sqliteBackupPath) {
|
|
|
|
return false
|
|
|
|
}
|
2022-08-20 22:10:31 +02:00
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
// Zip sqlite file, /metadata/items, and /metadata/authors folders
|
|
|
|
const zipResult = await this.zipBackup(sqliteBackupPath, newBackup).catch((error) => {
|
2021-10-09 00:30:20 +02:00
|
|
|
Logger.error(`[BackupManager] Backup Failed ${error}`)
|
|
|
|
return false
|
|
|
|
})
|
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
// Remove sqlite backup
|
|
|
|
await fs.remove(sqliteBackupPath)
|
2021-10-09 00:30:20 +02:00
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
if (!zipResult) return false
|
|
|
|
|
|
|
|
Logger.info(`[BackupManager] Backup successful ${newBackup.id}`)
|
|
|
|
|
|
|
|
newBackup.fileSize = await getFileSize(newBackup.fullPath)
|
|
|
|
|
|
|
|
const existingIndex = this.backups.findIndex(b => b.id === newBackup.id)
|
|
|
|
if (existingIndex >= 0) {
|
|
|
|
this.backups.splice(existingIndex, 1, newBackup)
|
2021-10-09 00:30:20 +02:00
|
|
|
} else {
|
2023-07-08 21:40:49 +02:00
|
|
|
this.backups.push(newBackup)
|
|
|
|
}
|
|
|
|
|
|
|
|
// Check remove oldest backup
|
|
|
|
if (this.backups.length > this.backupsToKeep) {
|
|
|
|
this.backups.sort((a, b) => a.createdAt - b.createdAt)
|
|
|
|
|
|
|
|
const oldBackup = this.backups.shift()
|
|
|
|
Logger.debug(`[BackupManager] Removing old backup ${oldBackup.id}`)
|
|
|
|
this.removeBackup(oldBackup)
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
2023-07-08 21:40:49 +02:00
|
|
|
return true
|
2021-10-09 00:30:20 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
async removeBackup(backup) {
|
|
|
|
try {
|
2021-10-10 23:36:21 +02:00
|
|
|
Logger.debug(`[BackupManager] Removing Backup "${backup.fullPath}"`)
|
2021-10-09 00:30:20 +02:00
|
|
|
await fs.remove(backup.fullPath)
|
|
|
|
this.backups = this.backups.filter(b => b.id !== backup.id)
|
|
|
|
Logger.info(`[BackupManager] Backup "${backup.id}" Removed`)
|
|
|
|
} catch (error) {
|
|
|
|
Logger.error(`[BackupManager] Failed to remove backup`, error)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
/**
|
|
|
|
* @see https://github.com/TryGhost/node-sqlite3/pull/1116
|
2023-08-06 10:05:53 +02:00
|
|
|
* @param {Backup} backup
|
2023-07-08 21:40:49 +02:00
|
|
|
* @promise
|
|
|
|
*/
|
|
|
|
backupSqliteDb(backup) {
|
|
|
|
const db = new sqlite3.Database(Database.dbPath)
|
|
|
|
const dbFilePath = Path.join(global.ConfigPath, `absdatabase.${backup.id}.sqlite`)
|
|
|
|
return new Promise(async (resolve, reject) => {
|
|
|
|
const backup = db.backup(dbFilePath)
|
|
|
|
backup.step(-1)
|
|
|
|
backup.finish()
|
|
|
|
|
|
|
|
// Max time ~2 mins
|
|
|
|
for (let i = 0; i < 240; i++) {
|
|
|
|
if (backup.completed) {
|
|
|
|
return resolve(dbFilePath)
|
|
|
|
} else if (backup.failed) {
|
|
|
|
return reject(backup.message || 'Unknown failure reason')
|
|
|
|
}
|
|
|
|
await new Promise((r) => setTimeout(r, 500))
|
|
|
|
}
|
|
|
|
|
|
|
|
Logger.error(`[BackupManager] Backup sqlite timed out`)
|
|
|
|
reject('Backup timed out')
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
zipBackup(sqliteBackupPath, backup) {
|
2021-10-09 00:30:20 +02:00
|
|
|
return new Promise((resolve, reject) => {
|
|
|
|
// create a file to stream archive data to
|
|
|
|
const output = fs.createWriteStream(backup.fullPath)
|
|
|
|
const archive = archiver('zip', {
|
|
|
|
zlib: { level: 9 } // Sets the compression level.
|
|
|
|
})
|
|
|
|
|
|
|
|
// listen for all archive data to be written
|
|
|
|
// 'close' event is fired only when a file descriptor is involved
|
|
|
|
output.on('close', () => {
|
|
|
|
Logger.info('[BackupManager]', archive.pointer() + ' total bytes')
|
2023-07-08 21:40:49 +02:00
|
|
|
resolve(true)
|
2021-10-09 00:30:20 +02:00
|
|
|
})
|
|
|
|
|
|
|
|
// This event is fired when the data source is drained no matter what was the data source.
|
|
|
|
// It is not part of this library but rather from the NodeJS Stream API.
|
|
|
|
// @see: https://nodejs.org/api/stream.html#stream_event_end
|
|
|
|
output.on('end', () => {
|
|
|
|
Logger.debug('Data has been drained')
|
|
|
|
})
|
|
|
|
|
2021-10-10 23:36:21 +02:00
|
|
|
output.on('finish', () => {
|
|
|
|
Logger.debug('Write Stream Finished')
|
|
|
|
})
|
|
|
|
|
|
|
|
output.on('error', (err) => {
|
|
|
|
Logger.debug('Write Stream Error', err)
|
|
|
|
reject(err)
|
|
|
|
})
|
|
|
|
|
2021-10-09 00:30:20 +02:00
|
|
|
// good practice to catch warnings (ie stat failures and other non-blocking errors)
|
|
|
|
archive.on('warning', function (err) {
|
|
|
|
if (err.code === 'ENOENT') {
|
|
|
|
// log warning
|
|
|
|
Logger.warn(`[BackupManager] Archiver warning: ${err.message}`)
|
|
|
|
} else {
|
|
|
|
// throw error
|
|
|
|
Logger.error(`[BackupManager] Archiver error: ${err.message}`)
|
|
|
|
// throw err
|
|
|
|
reject(err)
|
|
|
|
}
|
|
|
|
})
|
|
|
|
archive.on('error', function (err) {
|
|
|
|
Logger.error(`[BackupManager] Archiver error: ${err.message}`)
|
|
|
|
reject(err)
|
|
|
|
})
|
2021-10-10 23:36:21 +02:00
|
|
|
archive.on('progress', ({ fs: fsobj }) => {
|
2023-07-08 21:40:49 +02:00
|
|
|
const maxBackupSizeInBytes = this.maxBackupSize * 1000 * 1000 * 1000
|
2022-04-23 19:26:37 +02:00
|
|
|
if (fsobj.processedBytes > maxBackupSizeInBytes) {
|
2021-10-10 23:36:21 +02:00
|
|
|
Logger.error(`[BackupManager] Archiver is too large - aborting to prevent endless loop, Bytes Processed: ${fsobj.processedBytes}`)
|
|
|
|
archive.abort()
|
|
|
|
setTimeout(() => {
|
|
|
|
this.removeBackup(backup)
|
|
|
|
output.destroy('Backup too large') // Promise is reject in write stream error evt
|
|
|
|
}, 500)
|
|
|
|
}
|
|
|
|
})
|
2021-10-09 00:30:20 +02:00
|
|
|
|
|
|
|
// pipe archive data to the file
|
|
|
|
archive.pipe(output)
|
|
|
|
|
2023-07-08 21:40:49 +02:00
|
|
|
archive.file(sqliteBackupPath, { name: 'absdatabase.sqlite' })
|
|
|
|
archive.directory(this.ItemsMetadataPath, 'metadata-items')
|
|
|
|
archive.directory(this.AuthorsMetadataPath, 'metadata-authors')
|
2022-08-20 22:10:31 +02:00
|
|
|
|
2021-10-09 00:30:20 +02:00
|
|
|
archive.append(backup.detailsString, { name: 'details' })
|
|
|
|
|
|
|
|
archive.finalize()
|
|
|
|
})
|
|
|
|
}
|
|
|
|
}
|
|
|
|
module.exports = BackupManager
|