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

[Suggestion] Add functionality for reading a retriever until the end of the file (Unknown length) #12

Open
KSneijders opened this issue Sep 2, 2024 · 1 comment

Comments

@KSneijders
Copy link
Contributor

Add a way to the Retriever constructor to allow the repeat to increase until the end of the file is reached.
This is (for example) useful in log files where strings are pushed without knowing how many have been pushed in total. One would be able to do something like:

class LogFile(BaseStruct):
    logs: list[str] = Retriever(str32, default="", repeat_until_eof=True)

logfile = LogFile._from_file(path)

for line in logfile.logs:
    print(line)
@Divy1211
Copy link
Owner

Divy1211 commented Sep 8, 2024

This would indeed be nice to have, but some experimentation is required to figure out a good way to do this

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants