on master help sign in
Add documentation for streamFile function.
6f1be4fPaavo
wai-extra/Network/Wai/Middleware/StreamFile.hs+11
@@ -15,6 +15,17 @@ import Control.Monad (unless)
15import Data.Function (fix)
15import Data.Function (fix)
16import System.Posix
16import System.Posix
17
17
18+-- |Convert ResponseFile type responses into ResponseStream type
19+--
20+-- Checks the response type, and if it's a ResponseFile, converts it
21+-- into a ResponseStream. Other response types are passed through
22+-- unchanged.
23+--
24+-- Converted responses get a Content-Length header.
25+--
26+-- Streaming a file will bypass a sendfile system call, and may be
27+-- useful to work around systems without working sendfile
28+-- implementations.
18streamFile :: Middleware
29streamFile :: Middleware
19streamFile app env sendResponse = app env $ \res ->
30streamFile app env sendResponse = app env $ \res ->
20 case res of
31 case res of