From 387ab7e5821fff81cc6ea2916654b196d9bc2a41 Mon Sep 17 00:00:00 2001 From: Killer Boss Original <73131550+killerbossoriginal@users.noreply.github.com> Date: Thu, 23 Feb 2023 12:15:27 +0100 Subject: [PATCH] 2023.02.23.3 --- package.json | 2 +- src/index.ts | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/package.json b/package.json index 3544200..9b71b5b 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "mit.db", - "version": "2023.02.23.2", + "version": "2023.02.23.3", "description": "An easy and quick database", "main": "build/index.js", "types": "build/index.d.ts", diff --git a/src/index.ts b/src/index.ts index a504a86..cbc0ae6 100644 --- a/src/index.ts +++ b/src/index.ts @@ -4,6 +4,8 @@ import * as fs from 'fs'; const writeDB = promisify(fs.writeFile); class MitDB { + readonly db; + /** * @constructor * @param filename If not set, MapDB will only use internal memory @@ -12,15 +14,16 @@ class MitDB { * @param options.dirname where to put the database? */ constructor(fn: string, options?: { dirname: string }) { + let dirname; if (options && options.dirname) { - this.dirname = options.dirname; + dirname = options.dirname; } else { - this.dirname = 'data'; + dirname = 'data'; } if (!fs.existsSync(dirname)) fs.mkdirSync(dirname); - this.db = `./${dirname}/${filename}` + this.db = `./${dirname}/${fn}` } /**