0

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.

Robert Marlan
  • 369
  • 2
  • 11

1 Answers1

1

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

CloudBalancing
  • 1,461
  • 2
  • 11
  • 22
  • Yes I need to stream a large data file from the device to the node server. I need the node server interface to manage S3 bucket access for the mobile app that has multiple users. Amplify SDK looks like a great option except I am using Wasabi S3 and I don't think they support that. I am able to upload the multipart no problem with Alamofire but as you said its not a stream... Thanks. – Robert Marlan Apr 03 '21 at 15:28
  • Uploading such big files probably require background work. Id suggest exploring BackgroundTasks for it - https://developer.apple.com/forums/thread/129040 – CloudBalancing Apr 03 '21 at 17:24