net/read
core-api
cfunction
src/core/net.c on line 853, column 1
(net/read stream nbytes &opt buf timeout)
Read up to n bytes from a stream, suspending the current fiber
until the bytes are available. `n` can also be the keyword `:all`
to read into the buffer until end of stream. If less than n bytes
are available (and more than 0), will push those bytes and return
early. Takes an optional timeout in seconds, after which will raise
an error. Returns a buffer with up to n more bytes in it, or raises
an error if the read failed.