Robert Marlan
Robert Marlan

Reputation: 369

Streaming upload with multipart-form Swift IOS

I need to stream a datafile from an IOS/Swift app to my node API server backend. On the backend, I receive the POST data and upload this to an S3 bucket. I have implemented the upload from IOS with Alamofire and it works ok but this is not currently a streaming solution. My understanding is that Alamofire does not support multipart form-data streaming. Given the file sizes that I need to handle (100-500GB) I need to stream this.

Stream: IOS -> Node API -> S3

I can not find any solution to stream from IOS to the server Api. I know how to receive the POST stream to the server forward that to the S3 server. I just need to send the stream from the IOS App.

Any help would be most appreciated with code samples. Thanks.

Upvotes: 0

Views: 1084

Answers (1)

CloudBalancing
CloudBalancing

Reputation: 1676

Im not sure I fully understand what do you mean by stream here, as http multipart form-data is not really stream. Do you mean that you want to upload a file to the node server and kind of pipe the upload straight to S3? Is the node server absolutely needed in the process? Have you thought about using Amplify SDK to upload directly? https://docs.amplify.aws/lib/storage/getting-started/q/platform/ios#uploading-data-to-your-bucket? Alamofire do support multipart form-data - Upload files with parameters from multipartformdata using alamofire 5 in ios swift

Upvotes: 1

Related Questions