MCPcopy Create free account
hub / github.com/SBoudrias/Inquirer.js / readJSONFile

Function readJSONFile

tools/setup-packages/src/bin.ts:15–25  ·  view source on GitHub ↗
(filepath: string)

Source from the content-addressed store, hash-verified

13}
14
15function readJSONFile<T>(filepath: string): Promise<T> {
16 return (
17 readFile(filepath)
18 // oxlint-disable-next-line typescript/no-unsafe-type-assertion
19 .then((content) => parseJsonc(content) as T)
20 .catch((error: unknown) => {
21 console.error(`Error reading ${filepath}: ${String(error)}`);
22 throw error;
23 })
24 );
25}
26
27function fileExists(filepath: string) {
28 return fs.access(filepath).then(

Callers

nothing calls this directly

Calls 2

readFileFunction · 0.85
errorMethod · 0.80

Tested by

no test coverage detected