export class BearMetalStore { private store: Record = {}; private storePath: string; constructor(storePath?: string) { this.storePath = storePath || Deno.env.get("BEAR_METAL_STORE_PATH") || "./BearMetal/store.json"; this.readIn(); } public get(key: string): string | number | boolean { return this.store[key]; } public set(key: string, value: string | number | boolean): void { this.store[key] = value; this.writeOut(); } public delete(key: string): void { delete this.store[key]; this.writeOut(); } private readIn() { this.store = JSON.parse(Deno.readTextFileSync(this.storePath)); } private writeOut() { Deno.writeTextFileSync(this.storePath, JSON.stringify(this.store)); } }