Skip to content

haileys/axum-range

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

23 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

axum-range

HTTP range responses for axum.

Documentation.

MIT license.

Example usage

use axum_extra::TypedHeader;
use axum_extra::headers::Range;

use tokio::fs::File;

use axum_range::Ranged;
use axum_range::KnownSize;

async fn file(range: Option<TypedHeader<Range>>) -> Ranged<KnownSize<File>> {
    let file = File::open("archlinux-x86_64.iso").await.unwrap();
    let body = KnownSize::file(file).await.unwrap();
    let range = range.map(|TypedHeader(range)| range);
    Ranged::new(range, body)
}

About

http range responses for axum

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages