This commit is contained in:
Killer Boss Original 2023-02-23 11:58:44 +01:00 committed by GitHub
parent 693bc03318
commit e269f2c9d3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,7 +3,7 @@ import * as fs from 'fs';
const writeDB = promisify(fs.writeFile);
let map: any, db: any, filename: string, dirname: string;
let map: any, filename: string;
class MitDB {
/**
@ -14,17 +14,16 @@ class MitDB {
* @param options.dirname where to put the database?
*/
constructor(fn?: string, options?: { dirname: string }) {
if (!dirname || dirname != 'data') dirname = 'data';
map = new Map();
if (fn) filename = fn;
if (options && options.dirname) dirname = options.dirname;
if (options && options.dirname) const dirname = options.dirname;
else const dirname = 'data';
if (!fs.existsSync(dirname)) fs.mkdirSync(dirname);
db = `./${dirname}/${filename}`
const db = `./${dirname}/${filename}`
}
/**