ttf
This commit is contained in:
parent
693bc03318
commit
e269f2c9d3
1 changed files with 4 additions and 5 deletions
|
@ -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}`
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
Loading…
Reference in a new issue