Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide AsyncSeek on body reader. #325

Open
sagudev opened this issue Oct 18, 2021 · 0 comments
Open

Provide AsyncSeek on body reader. #325

sagudev opened this issue Oct 18, 2021 · 0 comments
Labels
enhancement New feature or request

Comments

@sagudev
Copy link

sagudev commented Oct 18, 2021

Currently there is no elegant way to seek through data stream, except using range headers manually. So I purpose adding AsyncSeek, that would provide seek method on body reader. The seek method would fail if response contains Accept-Ranges: none. In other cases the reader would actually send new request with appropriate Range header.

On SeekFrom::Start(x) the range header should look like Range: bytes={x}-, so the reader can read till the end of stream normally.
For SeekFrom::Current(x) is similar to upper example: Range: bytes={c+x}-; where c is current stream position.
For SeekFrom::End(x) we just get the last x bytes: Range: bytes=-{x}.

@Fishrock123 Fishrock123 added the enhancement New feature or request label Oct 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants