From 54ec1645febfde89292d2d407e3437cda4872303 Mon Sep 17 00:00:00 2001 From: jj Date: Wed, 30 Apr 2025 17:15:48 +0000 Subject: [PATCH] web/opfs: capitalize processing dir constant --- web/src/lib/storage.ts | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/web/src/lib/storage.ts b/web/src/lib/storage.ts index 30a6ffea..45bcf28f 100644 --- a/web/src/lib/storage.ts +++ b/web/src/lib/storage.ts @@ -1,4 +1,5 @@ -const cobaltProcessingDir = "cobalt-processing-data"; + +const COBALT_PROCESSING_DIR = "cobalt-processing-data"; export class OPFSStorage { #root; @@ -13,7 +14,7 @@ export class OPFSStorage { static async init() { const root = await navigator.storage.getDirectory(); - const cobaltDir = await root.getDirectoryHandle(cobaltProcessingDir, { create: true }); + const cobaltDir = await root.getDirectoryHandle(COBALT_PROCESSING_DIR, { create: true }); const handle = await cobaltDir.getFileHandle(crypto.randomUUID(), { create: true }); const reader = await handle.createSyncAccessHandle(); @@ -49,7 +50,7 @@ export class OPFSStorage { export const removeFromFileStorage = async (filename: string) => { const root = await navigator.storage.getDirectory(); - const cobaltDir = await root.getDirectoryHandle(cobaltProcessingDir); + const cobaltDir = await root.getDirectoryHandle(COBALT_PROCESSING_DIR); return await cobaltDir.removeEntry(filename); } @@ -57,7 +58,7 @@ export const clearFileStorage = async () => { if (navigator.storage.getDirectory) { const root = await navigator.storage.getDirectory(); try { - await root.removeEntry(cobaltProcessingDir, { recursive: true }); + await root.removeEntry(COBALT_PROCESSING_DIR, { recursive: true }); } catch { // ignore the error because the dir might be missing and that's okay! }