Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Should not readFile an entire file. #34

Open
uptownhr opened this issue May 1, 2013 · 1 comment
Open

Should not readFile an entire file. #34

uptownhr opened this issue May 1, 2013 · 1 comment

Comments

@uptownhr
Copy link

uptownhr commented May 1, 2013

fs.readFile, defeats the purpose for a SaxParser. This is loading the entire xml into memory and causes errors when loading large xml files.

SaxParser.prototype.parseFile = function(filename) { //This function will only work in the node.js environment.
var fs = require('fs');
var that = this;
fs.readFile(filename, function (err, data) {
that.parseString(data);
});
}

@lucasgonze
Copy link

Ah, this explains why I'm getting silent failures for a 1GB XML document and another one that is 100GB. Thanks.

The use of readFile is a policy choice that might be justifiable based on this project's goals, but failing silently instead of throwing an error is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants