I am trying to parse a large JSON file using a stream. If the file is encoded in ANSI I have no trouble, but if the file is UTF-8 formatted it throws an error:
stream.js:74
throw er; // Unhandled stream error in pipe.
^
Error: Invalid JSON (Unexpected "ï" at position 0 in state STOP)
the portion of my code where it fails looks like this:
fileStream = fs.createReadStream(jsonfile, { encoding: 'utf8' });
fileStream.pipe(JSONStream.parse('*'))
.pipe(es.through(function (data) { .....
Any Ideas why it doesn't recognize the formatting?