MCPcopy Index your code
hub / github.com/5e-bits/5e-database / readFileContent

Function readFileContent

scripts/update/processor.ts:52–61  ·  view source on GitHub ↗

* Reads and parses JSON content from a file path. * @param filepath The path to the JSON file. * @returns A promise resolving to the parsed data array, or an empty array on error/empty file.

(filepath: string)

Source from the content-addressed store, hash-verified

50 * @returns A promise resolving to the parsed data array, or an empty array on error/empty file.
51 */
52async function readFileContent(filepath: string): Promise<any[]> {
53 let fileContent = '';
54 try {
55 fileContent = readFileSync(filepath, 'utf8');
56 } catch (err) {
57 console.error(`Error reading file ${filepath}:`, err);
58 return [];
59 }
60 return parseJsonArrayContent(fileContent, filepath);
61}
62
63/**
64 * Calculates the bulk write operations (upserts/deletes) based on the diff

Callers 6

_handleFileAddedFunction · 0.85
_handleFileModifiedFunction · 0.85
_handleFileRenamedFunction · 0.85

Calls 1

parseJsonArrayContentFunction · 0.85

Tested by

no test coverage detected