The path to the JSON file.
An array containing the content of the JSON file specified by
filePath
.
const filePath = "data.json";
const data = await getFileData(filePath);
console.log(data); // Output: [ { id: 1, name: "John" }, { id: 2, name: "Jane" }, ... ]
Generated using TypeDoc
Reads the content of a JSON file and returns it as an array.
If there is an error during the file reading process, an empty array is returned.