summaryrefslogtreecommitdiffhomepage
path: root/js/src/storage
diff options
context:
space:
mode:
authorDax Raad <[email protected]>2025-05-18 02:43:01 -0400
committerDax Raad <[email protected]>2025-05-26 12:40:17 -0400
commitd0d67029f4baad7389b5ba072379c2ff44a22dc4 (patch)
treecb81e86662c14c20687bf5bac488dda911a9855e /js/src/storage
parenta34d020bc6b252e842f042d935c7a0e6444460cf (diff)
downloadopencode-d0d67029f4baad7389b5ba072379c2ff44a22dc4.tar.gz
opencode-d0d67029f4baad7389b5ba072379c2ff44a22dc4.zip
process
Diffstat (limited to 'js/src/storage')
-rw-r--r--js/src/storage/storage.ts26
1 files changed, 13 insertions, 13 deletions
diff --git a/js/src/storage/storage.ts b/js/src/storage/storage.ts
index b84e089cc..19e8dc06f 100644
--- a/js/src/storage/storage.ts
+++ b/js/src/storage/storage.ts
@@ -8,19 +8,17 @@ import { AppPath } from "../app/path";
export namespace Storage {
const log = Log.create({ service: "storage" });
- function state() {
- return App.service("storage", async () => {
- const app = await App.use();
- const storageDir = AppPath.storage(app.root);
- await fs.mkdir(storageDir, { recursive: true });
- const storage = new FileStorage(new LocalStorageAdapter(storageDir));
- await storage.write("test", "test");
- log.info("created", { path: storageDir });
- return {
- storage,
- };
- });
- }
+ const state = App.state("storage", async () => {
+ const app = await App.use();
+ const storageDir = AppPath.storage(app.root);
+ await fs.mkdir(storageDir, { recursive: true });
+ const storage = new FileStorage(new LocalStorageAdapter(storageDir));
+ await storage.write("test", "test");
+ log.info("created", { path: storageDir });
+ return {
+ storage,
+ };
+ });
function expose<T extends keyof FileStorage>(key: T) {
const fn = FileStorage.prototype[key];
@@ -36,4 +34,6 @@ export namespace Storage {
export const write = expose("write");
export const read = expose("read");
+ export const list = expose("list");
+ export const readToString = expose("readToString");
}