From dc33c07b398c318841e62d2f4f7a2bf6eb3b4ecd Mon Sep 17 00:00:00 2001 From: wukko Date: Thu, 6 Feb 2025 23:45:03 +0600 Subject: [PATCH] web/storage: add clearCacheStorage function --- web/src/lib/storage.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/web/src/lib/storage.ts b/web/src/lib/storage.ts index 3d9a04a3..30a6ffea 100644 --- a/web/src/lib/storage.ts +++ b/web/src/lib/storage.ts @@ -64,6 +64,14 @@ export const clearFileStorage = async () => { } } +export const clearCacheStorage = async () => { + const keys = await caches.keys(); + + for (const key of keys) { + caches.delete(key); + } +} + export const getStorageQuota = async () => { let estimate; if (navigator.storage.estimate) {