aws/s3/streaming

Hand-written convenience wrappers around streaming S3 operations.

The base get_object_streaming(client, input) -> Result(streaming.Response, runtime.ClientError) is emitted by the codegen directly on the s3 module (see s3.get_object_streaming). This module adds pure convenience helpers on top — patterns that come up often enough that surfacing them with their own typed error is worthwhile.

Values

pub fn download_to_bit_array_max(
  client: s3.Client,
  input: s3.GetObjectRequest,
  max_bytes: Int,
) -> Result(BitArray, streaming.CollectError(runtime.ClientError))

Convenience: stream a GetObject response and materialise its body as a BitArray, refusing if cumulative size would exceed max_bytes. Thin wrapper over streaming.collect_to_bit_array_max pinning the input error type to runtime.ClientError.

Typical “download a smallish-bounded object” case: small JSON / config blobs / log shards where the wire bytes fit in memory but the caller wants a hard ceiling. For multi-GB objects skip this helper and consume chunks via streaming.fold_chunks.

Search Document