Crate async_http_range_reader

source ·
Expand description

This library provides the AsyncHttpRangeReader type.

It allows streaming a file over HTTP while also allow random access. The type implements both AsyncRead as well as AsyncSeek. This is supported through the use of range requests. Each individual read will request a portion of the file using an HTTP range request.

Requesting numerous small reads might turn out to be relatively slow because each reads needs to perform an HTTP request. To alleviate this issue AsyncHttpRangeReader::prefetch is provided. Using this method you can prefect a number of bytes which will be streamed in on the background. If a read operation is reading from already (pre)fetched ranges it will stream from the internal cache instead.

Internally the AsyncHttpRangeReader stores a memory map which allows sparsely reading the data into memory without actually requiring all memory for file to be resident in memory.

The primary use-case for this library is to be able to sparsely stream a zip archive over HTTP but its designed in a generic fashion.

Structs§

Enums§