kvarn::read

Function file

source
pub async fn file<P: AsRef<str>>(
    path: P,
    cache: Option<&FileCache>,
) -> Option<Bytes>
Expand description

Reads a file using a cache. Should be used instead of fs::File::open().

Should be used when a file is typically only accessed once, and cached in the response cache, not files multiple requests often access.