node-xml
node-xml copied to clipboard
parseFile reads the entire file
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.
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.
+1