Skip to content

Instantly share code, notes, and snippets.

@samuelorji
Last active May 2, 2020 18:08
Show Gist options
  • Save samuelorji/4c960dcb7018b6fee0803418ea776970 to your computer and use it in GitHub Desktop.
Save samuelorji/4c960dcb7018b6fee0803418ea776970 to your computer and use it in GitHub Desktop.
Streaming Movies
val route = get {
path("download") {
val file = new File("movie.mp4")
respondWithHeaders(RawHeader("Content-Disposition", s"""attachment; filename="movie.mp4"""")) {
complete(HttpEntity(ContentTypes.`application/octet-stream`, FileIO.fromPath(file.toPath)))
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment