Skip to content

clientInstance.getObject Bytestream question #1017

Answered by jbelkins
bmwolf asked this question in Q&A
Discussion options

You must be logged in to vote

You are correct, the API did change with the introduction of HTTP bidirectional streaming in 0.16.0.

The way to get the data from your S3 object:

let output = try await clientInstance.getObject(input: input)
let data: Data?
switch output.body {
case .data(let bodyData):
    data = bodyData
case .stream(let stream):
    data = try stream.readToEnd()
default:
    data = nil
}

I recognize that this is a little cumbersome when you just want to get the data and the file is too short to worry about streaming it from S3; I'll look at ways to make this a little more convenient in a future SDK release.

Replies: 2 comments 1 reply

Comment options

You must be logged in to vote
1 reply
@bmwolf
Comment options

Answer selected by bmwolf
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants