Hi all,
I'm trying to use Akka http for large files (300MB is what I'm currently
testing) coming in as multi-part form data. The file gets written straight
to disk. The file ends up being a few MB short of complete and the upload
hangs indefinitely. I had a look at the files and the top and bottom match
so it must have missed a chunk somewhere in between? How would I prevent
this?
The code of interest is below:
val file = new File(localPath)
val sink = SynchronousFileSink(file)
entity(as[Multipart.FormData]) { (formdata: Multipart.FormData) =>
val fileNamesFuture = formdata.parts.mapAsync(1) { p =>
if (p.filename.isDefined) {
println(s"Got part. name: ${p.name} filename: ${p.
filename}")
p.entity.dataBytes.runWith(sink).map { bytesWritten
=>
"""{"result":"Finished upload"}""".parseJson
}
}
Thanks
--
>>>>>>>>>> Read the docs: http://akka.io/docs/
>>>>>>>>>> Check the FAQ:
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
---
You received this message because you are subscribed to the Google Groups "Akka
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.