Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Advantages over localStorage #17

Closed
pannous opened this issue Jun 10, 2017 · 5 comments
Closed

Advantages over localStorage #17

pannous opened this issue Jun 10, 2017 · 5 comments

Comments

@pannous
Copy link

pannous commented Jun 10, 2017

why not just use window.localStorage?

@sindresorhus sindresorhus changed the title advantages over localStorage Advantages over localStorage Jun 10, 2017
@sindresorhus
Copy link
Owner

Many reasons:

  • localStorage only works in the browser process.
  • localStorage is not very fault tolerant, so if your app encounters an error and quits unexpectedly, you could lose the data.
  • localStorage only supports persisting strings. This module supports any JSON supported type.
  • The API of this module is much nicer. You can set and get nested properties. You can set default initial config.

@pannous
Copy link
Author

pannous commented Jun 10, 2017

okay nice!!

I suggests to copy this list to the readme.md

@paranoidjk
Copy link

IMO,localStorage is not very safe, it may be leak through xss attack.

@rnmp
Copy link

rnmp commented Feb 2, 2021

Another advantage is subscriptions!

@timfish
Copy link

timfish commented Nov 7, 2021

It's also worth noting that localStorage and indexedDb data can be lost if a user installs an older version of your app which uses an older version of Electron.

Chromium only caters for upgrades to the underlying levelDb store. If you run a previous version of Electron, it can fail to read the levelDb store and deletes it to start again from scratch!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants