Awskit_s3_lwt_unix.Bodyinclude Awskit_s3.BODY
with type 'a io := 'a Lwt.t
and type t = Runtime.request_bodytype t = Runtime.request_bodyRuntime request body descriptor.
Values may be replayable, such as in-memory or file-backed bodies, or one-shot, such as bodies backed by a caller-owned stream.
Scoped writer passed to streaming body callbacks.
The writer is valid only while the callback supplied to of_stream is running. Do not store it or use it after the callback returns.
val empty : tEmpty replayable body with content length 0.
val of_string : string -> tBuild a replayable in-memory body from a string.
val of_bytes : bytes -> tBuild a replayable in-memory body from bytes.
val of_stream :
content_length:int64 ->
replayable:bool ->
write:(writer -> (unit, Awskit.Error.t) Stdlib.result Lwt.t) ->
(t, Awskit.Error.t) Stdlib.resultBuild a streaming request body with a known content_length.
replayable must be true only when retrying the request can recreate the same bytes by invoking write again. Negative content lengths are rejected before a request is sent. The supplied writer is scoped to one invocation of write.
val content_length : t -> int64 optionReturn the known content length for the body, when available.
val replayable : t -> boolReturn whether the body can be safely written again for retries.
module Writer : sig ... endval of_lwt_stream :
content_length:int64 ->
string Lwt_stream.t ->
(t, Awskit_s3.Error.t) Stdlib.resultBuild a non-replayable request body from an existing Lwt stream. content_length must match the produced bytes, and the stream must remain valid until the request finishes.
val of_channel :
content_length:int64 ->
?on_progress:(int64 -> unit) ->
Lwt_io.input_channel ->
(t, Awskit_s3.Error.t) Stdlib.resultBuild a non-replayable request body from an existing input channel. content_length must match the produced bytes, and the channel must remain valid until the request finishes. The caller owns and closes the channel.
val of_path :
?on_progress:(int64 -> unit) ->
string ->
(t, Awskit_s3.Error.t) Stdlib.result Lwt.tBuild a replayable request body from a regular file path. The file is reopened for each request attempt.