Skip to main content

get_object_text

Function get_object_text 

Source
pub async fn get_object_text(
    client: &Client,
    bucket: &str,
    key: &str,
    max_bytes: u64,
) -> Result<TextPayload, AppError>
Expand description

Fetch the first max_bytes bytes of bucket/key as a UTF-8 string.

Uses a Range: bytes=0-<max_bytes-1> request so the backend never buffers more bytes than needed for the preview.

ยงErrors

  • AppError::AccessDenied โ€” s3:GetObject permission denied.
  • AppError::NotFound โ€” bucket or key does not exist.
  • AppError::Network โ€” any other SDK or transport error.