"Error. EPERM: operation not permitted, stat" Electron application

100 views Asked by At

I'm getting the below error when getting files from the path on the client's machine:

enter image description here

I've function in my electron main process in which all the files are read from the path and uploaded to the server. Then once uploaded it is deleted from the machine.

Below is my code:

const stats = fs.statSync(path.join(app.getPath('appData'), 'Zinniax ChatHub/screenshots/') + fileName);
  const fileSizeInBytes = stats.size;

I'm getting an error at the fs.statSync function. I checked the permission of the folder as well as the individual file but all seems correct.

Any help would be appreciated.

1

There are 1 answers

3
Genie On

Change mod permissions on your images.

$ chmod 777 <image file name>

You can do this either file and both the directory.