electron-json-storage
electron-json-storage copied to clipboard
Properly Deleting All Data
I read questions were answered through issues here.
I was wondering what the best practice for deleting information was for this library. I know of a workaround to delete data, but given storage.clear() didn't work when I was trying to reset all data stored on a Electron app. I'd like to know if there are more proper methods to doing stuff like this.
Hey there!
but given storage.clear() didn't work
What do you mean by it didn't work? Did you get an exception?
Hi! More so its like it didn't run. Its a really odd problem overall. And I'm really curious if there's a way outside of .clear() that's considered a alternative best practice.
That seems strange. .clear() would just wipe out all the data files using rimraf: https://github.com/electron-userland/electron-json-storage/blob/master/lib/storage.js#L605.
What OS are you running this on? For example, I've seen similar weird problems due to anti-virus acquiring exclusive locks on files for scanning purposes, thus preventing any delete-action from taking place.
Also, what happens if you attempt to delete the specific JSON files using i.e. fs.unlink?
Oh! I'm on my friend's Linux laptop he lent me. Its running Ubuntu. Also, that worked like a charm. Weird, but if that's the official alternative I'll take note.
Interesting. Can you re-confirm that using .clear() does indeed not work on your machine, and no errors are reported?