So I have an XML file that is larger than 70mb. I would like to parse this data for in Node.js to do data visualizations on it eventually. To start, I thought it would be best to use JSON instead of XML, because Node.js is better built to work with JSON. So I planned to use the xml2json node module to parse the xml into JSON but I can't seem to write the xml file to a variable because its so large. I attempted to do this with the following code.
var fs = require('fs');
fs.readFile(__dirname + '/xml/ipg140114.xml', 'utf8', function(err, data, parseXml) {
if(err) {
return console.log(err);
}
});
I receive a stack trace error. Whats a better way to get this file converted into JSON so I can parse it with Node? I am pretty new to Node so let me know if my approach is wrong. Thanks in advance!