Skip to content

Made an event-driven Parser class - #8

Open
internot wants to merge 2 commits into
fgnass:masterfrom
internot:master
Open

Made an event-driven Parser class#8
internot wants to merge 2 commits into
fgnass:masterfrom
internot:master

Conversation

@internot

Copy link
Copy Markdown

One of the features of the parser is that it can continuosly parse chunks of text. I extended domino with an event-driven Parser class that takes an EventEmitter as argument and parse each chunk as it becomes available. I use it to parse the result of a http request without having to store it in a temporary buffer:

http.request(req, function(pres) {
var parser = new domino.Parser();
parser.parse(pres);
parser.on('end', function() {
var document = parser.document();
...
});
});

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

Labels

None yet

1 participant