snap-stream-0.1.1.0: Streaming Snap handlers

Safe HaskellNone
LanguageHaskell2010

Snap.Util.FileServe.Stream

Description

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

Documentation

serveStreamAs Source #

Arguments

:: 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.