Simple data persistence for Electron apps and modules, saving and loading user settings, app state, and cache as a JSON file in the user data directory. v11.0.2 is the current stable release, requiring Electron 30+ and Node.js 20+. The package is native ESM only (no CommonJS). Key differentiators: JSON Schema validation via ajv, atomic disk writes, dot-notation access for nested properties, migration support for version upgrades. Actively maintained by Sindre Sorhus.
npm install electron-storeNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Creates a store with defaults and schema validation, then demonstrates set, get, delete, and clear operations.
Convert your project to ESM (use 'import' instead of 'require'). More info: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c
Update Node.js to >=20 and Electron to >=30.
Consider implementing custom migration logic outside the library.
Access store after app 'ready' event or in the main process only if using in renderer.
Remove `beforeEachMigration` and include logic inside migration handlers.
Switch to ESM by setting 'type': 'module' in package.json and using import syntax.
Ensure the value passed to store.set() conforms to the schema type and constraints.
Use 'import Store from 'electron-store'' (default import).
Set 'type': 'module' in package.json or rename file to .mjs.