fs.access doesn't access callback
const checkPermissions = file => {
try {
fs.accessSync(file, fs.constants.R_OK);
console.log('can read/write');
return true;
} catch (err) {
console.error('is not readable is readable________________');
return false;
}
};
if (checkPermissions('./some/location/file.pdf')) {
console.log('I have permissions to the file');
} else {
console.error('I do NOT have permissions to the file');
}