Skip to content

Is it possible to read from a io.BytesIO or io.StringIO or just accepts filename? #35

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

Open
WaterKnight1998 opened this issue Jun 4, 2020 · 2 comments

Comments

@WaterKnight1998
Copy link

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.

@rbnvrw
Copy link
Member

rbnvrw commented Jun 6, 2020

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.

@WaterKnight1998
Copy link
Author

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

rbnvrw added a commit that referenced this issue Sep 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants