logo
pub fn send_file_range(
    filepath: &str,
    mimetype: Mime,
    as_attachment: bool,
    range: Option<&Range>
) -> PencilResult
Expand description

Sends the contents of a file to the client, supporting HTTP Range requests, so it allows only partial files to be requested and sent. This doesn’t support multiranges at the moment. Please never pass filenames to this function from user sources without checking them first. Set as_attachment to true if you want to send this file with a Content-Disposition: attachment header. This will return NotFound if filepath is not one file.