Is it possible to read from a io.BytesIO or io.StringIO or just accepts filename?
I am using this reader in a flask API.
I would like to be able to use this reader with a io.BytesIO or io.StringIO so there is no need to create a temporal file in the system.
Hi thanks for your question. There is no fundamental reason why this would not be possible, however as it stands, it is not implemented. The relevant code is in reader.py: https://github.com/rbnvrw/nd2reader/blob/492d0ec68d21e55e63aa2914f63edc8e0ace74fa/nd2reader/reader.py#L25
The Reader class expects a filename and uses open() to get a file object. I think if you would use io.BytesIO instead it would be a drop-in replacement (apart from some small changes in the code where a filename is expected).
Please let me know if you're interested in submitting a PR, otherwise it might take a little bit longer to add this feature.
Please let me know if you're interested in submitting a PR, otherwise it might take a little bit longer to add this feature.
@rbnvrw I am interested. However, maybe I need some, in tha case I will ask you here