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

File-like object for parseBuffer()? #4

Open
Holzhaus opened this issue May 14, 2015 · 0 comments
Open

File-like object for parseBuffer()? #4

Holzhaus opened this issue May 14, 2015 · 0 comments

Comments

@Holzhaus
Copy link
Contributor

Instead passing bytes or str objects to parseBuffer(data), it could take actual file-like objects.

That would not only make it suitable to pass huge (>100MiB) images (e.g. PSX, PSP, Dreamcast, Gamecube, etc.) to that function, it also makes it easy to pass archive contents:

If you want to read in-memory data like the current parseBuffer() implementation, you can still do that by using StringIO.StringIO objects as a wrapper to create a file-like object from a string.

The only downer is that the file-like objects returned by zipfile.ZipFile.open(...) and tarfile.TarFile.extractfile(...) do not support the seek() method, so these wouldn't work in all cases (e.g. the CDI/GDI parser in PR #3, which uses seek() a lot).

@garbear What do you think?

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

1 participant