Access Permission Issues for Datastore saved files. – Electron

I am using NeDB as a local storage for my electron app. Everything works fine except when I update my app , I want the data to be saved locally . But the new version cannot access data from files written by my old version . it throws an EACCESS : permission denied Exception.

var db = new Datastore({ filename:”PATH_TO_FILE”,autoload:true});

1 possible answer(s) on “Access Permission Issues for Datastore saved files. – Electron

  1. Nice to hear from you that you’re not worrying about security.
    Each your internal call to “crashSafeWriteFile” would reset my permissions set on target file to insecure.
    Anyway, without modification of NeDB I’m ABSOLUTELY unable to control over file permissions, because NeDB overwrite it asynchronously without any notification/callback.

    The simpliest way to properly handle file permissions is to pass it to NodeJS file operations via NeDB constructor.
    Otherwise it is unsolvable.