javascript - Node.js FileSystem access returns ENOENT despite the file existing -
i have node.js function uses fs.access check if file exists, readable , writable: function stackoverflowfunction() { try { fs.accesssync(`file://${__dirname}/config/config.ini`, fs.constants.f_ok | fs.constants.r_ok | fs.constants.w_ok); } catch (err) { console.log(err); } despite file existing, { error: enoent: no such file or directory, access 'file:///home/callcenter1/bookgenerator/config/config.ini' @ error (native) @ object.fs.accesssync (fs.js:248:11) @ object.fs.accesssync (electron_asar.js:420:27) @ getconfig (/home/callcenter1/bookgenerator/main.js:12:12) @ object.<anonymous> (/home/callcenter1/bookgenerator/main.js:18:10) @ module._compile (module.js:541:32) @ object.module._extensions..js (module.js:550:10) @ module.load (module.js:458:32) @ trymoduleload (module.js:417:12) @ function.module._load (module.js:409:3) errno: -2, code: 'enoent', syscall: 'access', path: 'file:///home/callcenter1/bookgenerator/config/confi