Safe Haskell | None |
---|---|
Language | Haskell2010 |
HTTP range requests include a header specifying the range of bytes expected in the response. For example:
Range: bytes=0-1023
See this <https://developer.mozilla.org/en-US/docs/Web/HTTP/Range_requests documentation> for more details on range requests.
Synopsis
- serveStreamAs :: MonadSnap m => ByteString -> Word64 -> (Word64 -> Word64 -> OutputStream Builder -> IO ()) -> (OutputStream Builder -> IO ()) -> m ()
- data RangeReq
- rangeParser :: Parser RangeReq
- checkRangeReq :: MonadSnap m => Request -> (Word64 -> Word64 -> OutputStream Builder -> IO ()) -> Word64 -> m Bool
- fromShow :: Show a => a -> Builder
Documentation
:: MonadSnap m | |
=> ByteString | MIME type |
-> Word64 | The size of the file being streamed |
-> (Word64 -> Word64 -> OutputStream Builder -> IO ()) | If a partial range is requested, this function is used to send that range. |
-> (OutputStream Builder -> IO ()) | If a partial range is not requested, this function is used to send the whole file. |
-> m () |
Serves a file, with support for range requests and explicit mime type specification.
This function can be used in the presence or absence of Range
headers: it
can be used to serve partial files and whole files.
Similar to serveFile
.