...If you need strict HTML spec compliance, have a look at parse5. htmlparser2 itself provides a callback interface that allows the consumption of documents with minimal allocations. While the Parser interface closely resembles Node.js streams, it’s not a 100% match. Use the WritableStream interface to process a streaming input.