10LOC

#quota

Web Platformintermediate

Persist storage with navigator.storage.persist

export const ensurePersistentStorage = async (): Promise<boolean> => {
  if (!navigator.storage?.persist) return false;
  if (await navigator.storage.persisted()) return true;
  return navigator.storage.persist();
};

Ask the browser for persistent storage so your app can keep data around longer.