Skip to content

Instantly share code, notes, and snippets.

@shinshin86
Created September 11, 2024 01:47
Show Gist options
  • Save shinshin86/42681c722c5c835e8628e9c797744fca to your computer and use it in GitHub Desktop.
Save shinshin86/42681c722c5c835e8628e9c797744fca to your computer and use it in GitHub Desktop.
Developer script to reset OPFS data on browser.
/**
* Developer script to reset OPFS data
* (Please run on Chrome devtools console)
*/
async function resetOPFS() {
if ('storage' in navigator && 'getDirectory' in navigator.storage) {
const root = await navigator.storage.getDirectory();
for await (const entry of root.values()) {
console.log(`Remove: ${entry.name} (${entry.kind})`);
await entry.remove();
}
console.log('OPFS has been reset');
} else {
console.log('OPFS is not supported in this browser');
}
}
resetOPFS().catch(console.error);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment