如何将Source [String,Future [IOResult]]转换为Source [ByteString,Future [IOResult]]] >> [

问题描述 投票:0回答:1
需要转换

val graph: Source[String, Future[IOResult]]= <some flow>

val graph: Source[ByteString, Future[IOResult]] =<some flow>

以便可以将其传递给Result,如下所示:

Result( header = ResponseHeader(OK, Map(CONTENT_DISPOSITION → s"application")), body = HttpEntity.Streamed(graph, None, None) )

任何帮助将不胜感激。谢谢。

需要转换值图:Source [String,Future [IOResult]] == [[到值图:Source [ByteString,Future [IOResult]] =

以便可以将其传递给Result,如图所示。] >

playframework akka-stream
1个回答
0
投票
val byteStringSource: Source[ByteString, Future[IOResult]] = graph.via(Flow.fromFunction(ByteString(_)))
© www.soinside.com 2019 - 2024. All rights reserved.