MCPcopy Create free account
hub / github.com/anus-dev/ANUS / readJsonFile

Function readJsonFile

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

Source from the content-addressed store, hash-verified

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

Callers 1

manageTelemetrySettingsFunction · 0.85

Calls 1

fileExistsFunction · 0.85

Tested by

no test coverage detected