I am implementing the AWS S3 file delivery API. I have to transfer bytes from S3 S3ObjectInputStream to the browser. We have the option of using files with a cloud cloud, this is not an option (mostly local development)
I have an InputStream, so the most obvious task would be to use Ok.chunked with Enumerator.fromStream (), but Enumerator.fromStream () has a very clear warning that the stream should not be slow. I guess AWS S3ObjectInputStream is probably one of the slowest streams.
http://www.playframework.com/documentation/2.2.x/api/ scala / index.html # play.api.libs. iteratee.Enumerator $
def fromStream(input: InputStream, chunkSize: Int = 1024 * 8)
(implicit ec: ExecutionContext): Enumerator[Array[Byte]]
Create an enumerator from the given input stream.
This enumerator will block on reading the input stream, in the default iteratee
thread pool. Care must therefore be taken to ensure that this isn't a
slow stream. If using this with slow input streams, consider setting the value
of iteratee-threadpool-size to a value appropriate for handling the blocking.
, , - .
Enumerator ( -, ) InputStream?