I'm getting the below error when getting files from the path on the client's machine:
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.

Change mod permissions on your images.
You can do this either file and both the directory.