Skip to content

Instantly share code, notes, and snippets.

@csemrm
Last active August 29, 2015 14:20
Show Gist options
  • Save csemrm/9c87a63d4d38e6b2533a to your computer and use it in GitHub Desktop.
Save csemrm/9c87a63d4d38e6b2533a to your computer and use it in GitHub Desktop.
fs.exists('data/ipg150303.xml', function (exists) {
console.log("exists" + exists);
if (exists) {
console.log("exists" + exists);
fs.readFile('data/ipg150303.xml', 'utf8', function (err, data) {
if (err) {
return console.log(err);
}
data = data.split('<?xml version="1.0" encoding="UTF-8"?>');
console.log('data.length' + data.length);
console.log('data[0]' + data[1]);
var xml2js = require('xml2js');
var json;
try {
var fileData = data[1];
var parser = new xml2js.Parser();
parser.parseString(fileData.substring(0, fileData.length), function (err, result) {
json = JSON.stringify(result);
console.log(JSON.stringify(result));
});
console.log("File was successfully read.\n");
return json;
} catch (ex) {
console.log(ex);
}
});
}
});
@csemrm
Copy link
Author

csemrm commented May 7, 2015

error:

Fatal error in ../deps/v8/src/handles.h, line 48

CHECK(location_ != NULL) failed

==== C stack trace ===============================

1: ??
2: ??
3: ??
4: ??
5: ??
6: ??
7: ??
Illegal instruction: 4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment