diff --git a/workers/main/src/common/fileUtils.ts b/workers/main/src/common/fileUtils.ts index a6116c2..c0c26e8 100644 --- a/workers/main/src/common/fileUtils.ts +++ b/workers/main/src/common/fileUtils.ts @@ -30,3 +30,14 @@ export async function writeJsonFile( throw new FileUtilsError(`Failed to write JSON file at "${filePath}"`); } } + +export async function deleteJsonFile(filePath: string): Promise { + try { + await fs.unlink(filePath); + } catch (error) { + // Ignore ENOENT (file not found) errors as they're expected when clearing + if ((error as NodeJS.ErrnoException).code !== 'ENOENT') { + throw new FileUtilsError(`Failed to delete JSON file at "${filePath}"`); + } + } +}