Skip to content

Instantly share code, notes, and snippets.

@akashnimare
Created September 6, 2017 22:28
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save akashnimare/2b0d1abbb303f2a3159821322d40d091 to your computer and use it in GitHub Desktop.
Save akashnimare/2b0d1abbb303f2a3159821322d40d091 to your computer and use it in GitHub Desktop.
Clearing application data in Electron
const path = require('path');
const { app } = require('electron');
const fs = require('fs-extra');
const appName = app.getName();
// Get app directory
// on OSX it's /Users/Yourname/Library/Application Support/AppName
const getAppPath = path.join(app.getPath('appData'), appName);
fs.unlink(getAppPath, () => {
// callback
alert("App data cleared");
// You should relaunch the app after clearing the app settings.
app.relaunch();
app.exit();
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment