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

parseFile reads the entire file #18

Open
wampleek opened this issue Jun 24, 2011 · 2 comments
Open

parseFile reads the entire file #18

wampleek opened this issue Jun 24, 2011 · 2 comments

Comments

@wampleek
Copy link

I think the primary reason to use a Sax parser is concern about doc size. Should this module consider file streaming instead of a full read? As written, I suspect there is only a 2-4x memory savings over building the document in memory.

@JasonWoof
Copy link

Yeah, this is really bad. The code should be like this:

var s = fs.ReadStream(filename);
s.on('data', function(d) {
    parser.parseString(d, false);
});
s.on('end', function() {
    parser.parseString('', true);
});

See also issue #21 where you should be able to say when the input has ended.

@marook
Copy link

marook commented Apr 29, 2013

+1

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

3 participants