The space in the JSON output seems to be BOM. If so,
data.codePointAt(0) should be
When you read file in with
fs.readFileSync the BOM is not stripped from the data read and it is up to the programmer to handle it. See fs.readFileSync(filename, 'utf8') doesn't strip BOM markers.
You may just use
data = data.replace(/^\uFEFF/, '')
This will remove the BOM if it is there, and then you may run your regex.
Note you do not see the BOM when opening text files in text editors, like VIM, Notepad, because they can handle BOM.