diff --git a/scripts/core/db.js b/scripts/core/db.js index 9b8b0d6d..032e7199 100644 --- a/scripts/core/db.js +++ b/scripts/core/db.js @@ -6,8 +6,11 @@ const DB_DIR = process.env.DB_DIR || './scripts/database' class Database { constructor(filepath) { this.filepath = filepath + } + + load() { this.db = nedb.create({ - filename: file.resolve(filepath), + filename: file.resolve(this.filepath), autoload: true, onload: err => { if (err) console.error(err) @@ -36,6 +39,10 @@ class Database { return this.db.persistence.compactDatafile() } + stopAutocompact() { + return this.db.persistence.stopAutocompaction() + } + reset() { return file.clear(this.filepath) }