MCPcopy Create free account
hub / github.com/ConardLi/easy-llm-cli / readJsonFile

Function readJsonFile

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

Source from the content-addressed store, hash-verified

95}
96
97export function readJsonFile(filePath) {
98 if (!fileExists(filePath)) {
99 return {};
100 }
101 const content = fs.readFileSync(filePath, 'utf-8');
102 try {
103 return JSON.parse(content);
104 } catch (e) {
105 console.error(`Error parsing JSON from ${filePath}: ${e.message}`);
106 return {};
107 }
108}
109
110export function writeJsonFile(filePath, data) {
111 fs.writeFileSync(filePath, JSON.stringify(data, null, 2));

Callers 1

manageTelemetrySettingsFunction · 0.85

Calls 1

fileExistsFunction · 0.85

Tested by

no test coverage detected