我从相机Feed收到一个HTTP请求,每隔10秒左右就会向我的PlayFramework应用程序发送大约4MB的原始数据。有没有什么好方法可以从请求中捕获原始数据并将其保存到磁盘?
def uploadVideoChunk = Action(parse.raw) { request =>
println(s"Got the request ${request.body.size}")
val chunkOption = for {
content = request.body
} yield {
VideoChunk(content)
}
chunkOption foreach { chunk =>
val bytes = chunk.content.toString().getBytes
Files.write(Paths.get("/tmp/video/", "ID-1", chunk.filename), ***???*** )
println(s"wrote $chunk")
}
Ok("some response")
}