function haveLocalAccess(filePath, mode = 'r') {
  const accessMode = constants.F_OK | (mode === 'w') ? constants.W_OK : constants.R_OK;

  try {
    accessSync(filePath, accessMode);
    const type = localExists(filePath);
    return {
      status: true,
      type: type,
      details: 'access OK',
      code: 0,
    };
  } catch (err) {
    switch (err.errno) {
      case -2: {
        return {
          status: false,
          type: null,
          details: 'not exist',
          code: -2,
        };
      }
      case -13: {
        return {
          status: false,
          type: localExists(filePath),
          details: 'permission denied',
          code: -13,
        };
      }
      case -20: {
        return {
          status: false,
          type: null,
          details: 'parent not a directory',
        };
      }
      default: {
        return {
          status: false,
          type: null,
          details: err.message,
        };
      }
    }
  }
}
Verify access to local object. Returns an object with properties for status, type,
details and code.

return object {
                status: true if exists and can be accessed, false otherwise
                type: type of object '-' = file, 'd' = dir, 'l' = link, 's' = socket
                details: 'access ok' if object can be accessed, 'not found' if
                         object does not exist, 'permission denied' if access denied
                code: error code if object does not exist or permission denied
             }

@param {string} filePath = path to local object
@param {string} mode = access mode - either 'r' or 'w'. Defaults to 'r'
@returns {Object} with properties status, type, details and code