A response with the contents of the file at path, read in pieces as the client takes them
(Content-Length is the file's size when the response is sent). An empty content_type is
chosen from the file's extension (application/octet-stream when unknown). A file that cannot
be opened is a 404, or a 500 for any other failure; a file that shrinks while it is sent cuts
the connection.
- path: the file to send.
- content_type: the
Content-Typeheader value. Empty picks one from the extension. - status: the HTTP status code.
file_response :: (path: string, content_type := "", status := 200) -> Response
A response with the contents of the file at path, read in pieces as the client takes them
(Content-Length is the file's size when the response is sent). An empty content_type is
chosen from the file's extension (application/octet-stream when unknown). A file that cannot
be opened is a 404, or a 500 for any other failure; a file that shrinks while it is sent cuts
the connection.
Parameters
- path: string
- the file to send.
- content_type := ""
- the
Content-Typeheader value. Empty picks one from the extension. - status := 200
- the HTTP status code.