sax-wasm
sax-wasm copied to clipboard
How to pipe stream into the parser?
I try to pipe a stream into the parser, but it fails:
const fs = require('fs');
const { SaxEventType, SAXParser } = require('sax-wasm');
const parser = new SAXParser(SaxEventType.Attribute | SaxEventType.OpenTag, {highWaterMark: 32 * 1024});
parser.eventHandler = (event, data) => {
console.log(JSON.stringify(data))
};
fs.createReadStream(`sample.xml`).pipe(parser);
Uncaught TypeError TypeError: dest.on is not a function
at Readable.pipe (node:internal/streams/readable:743:8)
I also tried with prepareWasm() but no success either.
Is it supported somehow?