* 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)
| 50 | * @returns A promise resolving to the parsed data array, or an empty array on error/empty file. |
| 51 | */ |
| 52 | async 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 |
no test coverage detected