Replies: 2 comments
-
Are you using Soto v6 or the release candidate for v7? Regardless you need to use a streamed request which provides your putObject payload in chunks. This would allow you to catch the point when each chunk is read and use that to workout upload progress. I can't remember the exact syntax for these at the moment. For responses you need it to return the payload in chunks. You can then calculate the progress based on how many chunks you have received. V6 has specials forms of functions that return streamed payloads. They are all have the suffix |
Beta Was this translation helpful? Give feedback.
-
I'm using v7, and I'm using the streaming version of calls. It would be really nice if I could pass a progress callback to methods like try await FileSystem.shared.withFileHandle(forReadingAt: .init(inURL.path))
{ (inFH: ReadFileHandle) -> Void in
let fileSize = try await inFH.info().size
let fileChunks = inFH.readChunks(in: 0 ..< fileSize, chunkLength: .kilobytes(32))
let body = AWSHTTPBody(asyncSequence: fileChunks, length: Int(fileSize))
let req = S3.PutObjectRequest(acl: .publicRead,
body: body,
bucket: "",
contentType: inContentType,
key: inPath)
let resp = try await s3.putObject(req)
} |
Beta Was this translation helpful? Give feedback.
-
I'm uploading files to DigitalOcean Spaces using
S3.PutObjectRequest
andtry await s3.putObject(putObjectRequest)
, and I'm wondering if there’s any way to get callbacks periodically indicating the upload progress (and the same question applies to downloads). TIA!Beta Was this translation helpful? Give feedback.
All reactions