2

I have many clients that will upload arbitrarily large files (i.e., let's say up to 5GB). For performance reasons, this has to be done in a streaming way where the clients can split the file into a series of chunks before uploading them in parallel. Then, the server will take care of building the file from these chunks. I think this method is better known as chunked file upload.

However, Spray.io does not seem to offer any high-level building blocks for performing chunked file uploads. Am I missing something obvious here or do I really have to build this functionality from scratch? It's a bit weird if they don't since they already provide an easy to use mechanism to stream response.

lolski
  • 16,231
  • 7
  • 34
  • 49
  • The reason is that spray relies on the third-party mimepull library to parse multipart messages. Unfortunately, the library doesn't support streaming access. https://github.com/spray/spray/blob/master/examples/spray-can/simple-http-server/src/main/scala/spray/examples/FileUploadHandler.scala contains an example which allows receiving uploads in a streaming fashion. However, as it still relies on mimepull for splitting the multipart message it may still load the complete data into memory. In akka-http this problem is fixed as streaming is an essential part of the model. – jrudolph May 16 '15 at 21:19

0 Answers0