MCPcopy Index your code
hub / github.com/Waishnav/devspace / readJsonFile

Function readJsonFile

src/user-config.ts:91–98  ·  view source on GitHub ↗
(filePath: string)

Source from the content-addressed store, hash-verified

89}
90
91function readJsonFile<T>(filePath: string): T {
92 try {
93 return JSON.parse(readFileSync(filePath, "utf8")) as T;
94 } catch (error) {
95 const reason = error instanceof Error ? error.message : String(error);
96 throw new Error(`Unable to read ${filePath}: ${reason}`);
97 }
98}
99
100function writeJsonFile(filePath: string, value: unknown, mode: number): void {
101 writeFileSync(filePath, JSON.stringify(value, null, 2) + "\n", { mode });

Callers 1

loadDevspaceFilesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected