From 4e69d834578c14215dbeef929813344a70c7ca72 Mon Sep 17 00:00:00 2001 From: Flam3rboy <34555296+Flam3rboy@users.noreply.github.com> Date: Thu, 27 May 2021 20:01:50 +0200 Subject: :construction: file storage --- src/util/FileStorage.ts | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) (limited to 'src/util/FileStorage.ts') diff --git a/src/util/FileStorage.ts b/src/util/FileStorage.ts index 01be0050..b4d00213 100644 --- a/src/util/FileStorage.ts +++ b/src/util/FileStorage.ts @@ -1,7 +1,13 @@ import { Storage } from "./Storage"; +import fs from "fs/promises"; +import { join } from "path"; export class FileStorage implements Storage { - async get(path: string, prefix?: string) {} + async get(path: string) { + return fs.readFile(join(process.env.STORAGE_LOCATION || "", path), { encoding: "binary" }); + } - async set(path: string, value: any) {} + async set(path: string, value: any) { + return fs.writeFile(join(process.env.STORAGE_LOCATION || "", path), value, { encoding: "binary" }); + } } -- cgit 1.5.1