MCPcopy Index your code
hub / github.com/google-gemini/gemini-cli / readJsonFile

Function readJsonFile

scripts/telemetry_utils.js:109–120  ·  view source on GitHub ↗
(filePath)

Source from the content-addressed store, hash-verified

107}
108
109export function readJsonFile(filePath) {
110 if (!fileExists(filePath)) {
111 return {};
112 }
113 const content = fs.readFileSync(filePath, 'utf-8');
114 try {
115 return JSON.parse(content);
116 } catch (e) {
117 console.error(`Error parsing JSON from ${filePath}: ${e.message}`);
118 return {};
119 }
120}
121
122export function writeJsonFile(filePath, data) {
123 fs.writeFileSync(filePath, JSON.stringify(data, null, 2));

Callers 1

manageTelemetrySettingsFunction · 0.70

Calls 2

fileExistsFunction · 0.70
errorMethod · 0.65

Tested by

no test coverage detected