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

Changing readers to async iterators #5911

Open
1 task done
alex-eri opened this issue Jul 25, 2021 · 0 comments
Open
1 task done

Changing readers to async iterators #5911

alex-eri opened this issue Jul 25, 2021 · 0 comments

Comments

@alex-eri
Copy link
Contributor

Is your feature request related to a problem?

Not problem, but looks legacy

while True:
    chunk = await field.read_chunk()
    if not chunk:
         break

or

    reader = await request.multipart()
    while True:
        field = await reader.next()
        if field is None: break

Describe the solution you'd like

async for chunk in field.chunks():
   f.write(chunk)

or

async for field in (await request.multipart()):
    ....

Describe alternatives you've considered

Or fix docs on objects already has anext interface.

Related component

Server

Additional context

No response

Code of Conduct

  • I agree to follow the aio-libs Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant