Function betterstreams::fs::read_range[][src]

pub async fn read_range<P: AsRef<Path>>(
    path: P,
    range: Option<Range<u64>>
) -> Result<ChunkedStreamInfo>
Expand description

Read a range of bytes from a file.

Passing a None range will return the whole file as a stream.

Examples

use std::ops::Range;

use betterstreams::fs;
use tokio::runtime::Runtime;

Runtime::new().unwrap().block_on(async {
    let stream_info = fs::read_range("hello.txt", Some(Range{start: 10, end: 15}))
        .await.unwrap();
})