DenoDDeno
Powered by
vukmeanswolfV
Denoβ€’4y agoβ€’
39 replies
vukmeanswolf

Properly continuously read data from a Reader

What's the proper way to continuously read from a
Deno.Reader
Deno.Reader
?

I'm trying to parse incoming HTTP2 frames from a
Deno.TlsConn
Deno.TlsConn
, but my current method of reading involves two sets of
while
while
loops, one to continuously perform the read operation, and the other, to try read everything currently available to read from the stream in chunks of 16k.
Naturally, the
while
while
loops make it take approximately one entire core of my processor, which is far from ideal.

Can this in any way be improved? Is there a way to know (wait for a promise to resolve or such) when there is available data?
Deno banner
DenoJoin
Chat about Deno, a modern runtime for JavaScript and TypeScript.
20,934Members
Resources
Recent Announcements

Similar Threads

Was this page helpful?

Similar Threads

Read one byte at a time from ReadableStream
abiAabi / help
4y ago