`.stream(cb)` method
See original GitHub issueJust as an idea: The parser could do much more when it would actually get a stream of data. This would allow the creation of the DOM while IO is happening, which will speed up initial loading (and more stuff could be done inside of DomHandler).
There is already a WritableStream.js
file shipped with htmlparser2
(it’s accessible via require("htmlparser2").WritableStream
) that pretty much solves all problems. The implementation of the cheerio method could look like this:
cheerio.createWritableStream = function(cb, options){
var handler = new DomHandler(function(dom){ cb(cheerio(dom)); }, options);
return new WritableStream(handler, options);
};
Issue Analytics
- State:
- Created 11 years ago
- Comments:9 (9 by maintainers)
Top Results From Across the Web
Stream | Node.js v19.3.0 Documentation
A key goal of the stream API, particularly the stream.pipe() method, is to limit the buffering of data to acceptable levels such that...
Read more >Kelas CB Method LIVE - YouTube
Kelas CB Method : https://cbmethod.onpay.my/order/form/cbkelasPelajari buat duit USD dengan Clickbank.#clickbank #USD.
Read more >JPA 2.2's new getResultStream() method and how you ...
JPA 2.2's getResultStream() method returns the result set as a Stream, which can help to process it efficiently. But there are some things...
Read more >The Definitive Guide to Object Streams in Node.js
Node.js Streams come with a great power. This post walks you through the theory, and teaches how to use object stream transformables, ...
Read more >How to use the binary.stream function in binary
function session (stream, cb) { Binary.stream(stream) .word8('ver') .word8('nmethods') ... username + password only //var method = methods[2] ?
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
looking back at my example, I kind of think adding URL fetching functionality is a bit leaky (do we then support headers, what kind of request methods, etc).
It would be nice to add a streaming interface though, as @fb55 did with cornet. Perhaps more along the lines of:
Closing in favour of #2051.