function readJson(filename, reviver) {
  if (fs.existsSync(filename + '.gz')) {
    filename = filename + '.gz';
  }

  if (!filename.endsWith('.json.gz')) {
    return JSON.parse(fs.readFileSync(filename, 'utf8'), reviver);
  }

  const buffer = gunzipSync(fs.readFileSync(filename));
  return JSON.parse(buffer.toString('utf8'), reviver);
}
Prefers reading a gzipped file (.gz) if present.
@param {string} filename
@param {(this: any, key: string, value: any) => any=} reviver