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

Properly Deleting All Data #184

Open
sorcerer-worker opened this issue Jul 29, 2022 · 5 comments
Open

Properly Deleting All Data #184

sorcerer-worker opened this issue Jul 29, 2022 · 5 comments

Comments

@sorcerer-worker
Copy link

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.

@jviotti
Copy link
Member

jviotti commented Jul 29, 2022

Hey there!

but given storage.clear() didn't work

What do you mean by it didn't work? Did you get an exception?

@sorcerer-worker
Copy link
Author

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.

@jviotti
Copy link
Member

jviotti commented Aug 1, 2022

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?

@sorcerer-worker
Copy link
Author

sorcerer-worker commented Aug 2, 2022

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.

@jviotti
Copy link
Member

jviotti commented Aug 4, 2022

Interesting. Can you re-confirm that using .clear() does indeed not work on your machine, and no errors are reported?

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

2 participants