Runtime.Response_bodytype 'a io = 'a ttype t = response_bodyRuntime-owned response body value.
type reader = response_body_readerScoped response-body reader. It must not be used outside with_reader.
val read :
reader ->
bytes ->
off:int ->
len:int ->
(int, Awskit.Error.t) Stdlib.result ioRead into bytes. Returns Ok 0 at end-of-body. Invalid bounds return Error Body. Native runtime cancellation remains native. After a read error, timeout, or cancellation, the reader is no longer valid.
val next :
?chunk_size:int ->
reader ->
(bytes option, Awskit.Error.t) Stdlib.result ioRead the next chunk, or None at end-of-body. chunk_size must be positive.
val with_reader :
t ->
consume:(reader -> ('a, Awskit.Error.t) Stdlib.result io) ->
('a, Awskit.Error.t) Stdlib.result ioScope a response body reader to consume.
Callers must not retain the reader after consume returns. Runtime adapters must attempt to drain or discard the response body after consume. If consume returns Ok _, a drain failure is returned. If consume returns Error _, that error wins over cleanup failures. If consume raises or native cancellation occurs, cleanup is attempted and the original exception or cancellation is preserved.
val discard : t -> (unit, Awskit.Error.t) Stdlib.result ioDrain and ignore the response body, subject to the runtime drain timeout and byte limit.