You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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).
Instead passing
bytes
orstr
objects toparseBuffer(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:
zipfile.ZipFile.open(...)
tarfile.TarFile.extractfile(...)
bz2.BZ2File
objectsgzip.GzipFile
objectsIf you want to read in-memory data like the current
parseBuffer()
implementation, you can still do that by usingStringIO.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(...)
andtarfile.TarFile.extractfile(...)
do not support theseek()
method, so these wouldn't work in all cases (e.g. the CDI/GDI parser in PR #3, which usesseek()
a lot).@garbear What do you think?
The text was updated successfully, but these errors were encountered: