Skip to main content

download

Function download 

Source
pub async fn download(
    __arg0: State<AppState>,
    method: Method,
    headers: HeaderMap,
    __arg3: Query<PathQuery>,
) -> Response
Expand description

GET /api/v1/fs/file — the whole file, or a range of it.

HEAD reaches this handler too: axum’s get() serves it automatically, running the same handler and discarding the body. Without the method check below, that meant loading the entire file into a Vec purely to throw it away — waste on every call, and an amplification on a large file. include_body skips every read while still computing the same status and headers a GET would.