code: function isWriteable(file) {
    let writePermission = true;
    try {
      const __fd = fs.openSync(file, 'a');
      fs.closeSync(__fd);
    } catch (e) {
      /* istanbul ignore next */
      writePermission = false;
    }
  
    return writePermission;
  }
docs: Hack to determine if file has write permissions for current user Avoids having to check user, group, etc, but it's probably slow.