function saveTraceFromCLI() {
  if (!process.argv[2]) {
    printErrorAndQuit('Lighthouse JSON results path not provided');
  }
  const filename = path.resolve(process.cwd(), process.argv[2]);
  if (!fs.existsSync(filename)) {
    printErrorAndQuit('Lighthouse JSON results not found.');
  }

  const lhrObject = JSON.parse(fs.readFileSync(filename, 'utf8'));
  const jsonStr = createTraceString(lhrObject);

  const pathObj = path.parse(filename);
  const traceFilePath = path.join(pathObj.dir, `${pathObj.name}.timing.trace.json`);
  fs.writeFileSync(traceFilePath, jsonStr, 'utf8');
  console.log(`
  > Timing trace file saved to: ${traceFilePath}
  > Open this file in DevTools perf panel   (For --audit-mode runs, use chrome://tracing instead)
`);
}
Takes filename of LHR object. The primary entrypoint on CLI