To fix JSON.parse(fs.readFileSync()) returning a buffer with Node, we specify the encoding.
For instance, we write
const squadJSON = JSON.parse(fs.readFileSync("file.json", "utf8"));
to call readFileSync
to open the file.json file.
We specify the encoding is 'utf8'
to return a Unicode string instead of a buffer.