Skip to content

decrypt_file_iter, a generator yielding chunks that *would* be passed to on_data? Concise alternative to using on_data for streaming #246

@vergenzt

Description

@vergenzt

Is your feature request related to a problem? Please describe.
It'd be nice to be able to iterate over streamed chunks in gpg.decrypt_file instead of having to set an on_data callback.

Describe the solution you'd like
Use one of the functions from https://stackoverflow.com/questions/9968592/turn-functions-with-a-callback-into-python-generators to wrap decrypt_file, yield-ing each chunk of the file as it streams.

Then once the iterator terminates, perhaps a separate method could get the result from the GPG object? Not sure the best way to handle this. Or maybe just raise an exception if there's any failure and ignore the result object otherwise?

Describe alternatives you've considered
Just using on_data and doing this myself. 🙂

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions