My scala-play api provides endpoints to return a file as a stream via the Ok.chunked-function.
I now want to be able to allow the download of multiple files as a zip archive.
I want to create a zip file as a stream which play should directly return as a filestream. Meaning without the need to temporarly save the zip-file on the disc and serving it while it is being created.
What would be a good way to implemente a function that creates this stream?
I solved the issue by using akkas alpakka.
First I create a akka
ByteStringsource. The source is used inside theTupel2with someArchiveMetadata. This tuple can than be used to create a new source which can be connected to alpakkasArchive.zip().The resulting stream can than be used with plays
Ok.chunked.I hope this solution might help you if you have the same question.