sax-async
v0.0.4
Published
Wrapper around sax-js to allow for asynchronous event handlers, and using streams2 to properly exert backpressure on piped streams
Downloads
7
Readme
Version of sax-js which uses the new streams API for backpressure, and allows callbacks on the events using crisphooks.
var SaxAsync = require('sax-async');
var strict = false;
var options = {};
var parseStream = new SaxAsync(strict, options);
parseStream.hookAsync('closetag', function(next, tag) {
console.log(tag);
setTimeout(next, 100);
});
parseStream.hookSync('end', function() {
console.log('Ended.');
});
require('fs').createReadStream('./test.xml').pipe(parseStream);