Skip to content

Python: add new identify_stream API#979

Merged
reyammer merged 3 commits intomainfrom
py-970-identify-stream
Mar 12, 2025
Merged

Python: add new identify_stream API#979
reyammer merged 3 commits intomainfrom
py-970-identify-stream

Conversation

@reyammer
Copy link
Collaborator

This PR adds a new identify_stream API, as suggested in #970. With this API, one can identify the content type of an already-open stream; the implementation does not read the full file, and it just seek()s around. This new API avoids clients to be forced to (directly or indirectly) read the full file's content in memory.

Fixes #970.

Copy link

@afourney afourney left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've reviewed the implementation, and I love the care to detail on common errors etc. I've not had a chance to test this yet, but will ASAP. I look forward to this feature.

@reyammer reyammer merged commit bab53a5 into main Mar 12, 2025
51 checks passed
@reyammer reyammer deleted the py-970-identify-stream branch March 12, 2025 07:57
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

Successfully merging this pull request may close these issues.

Implement: identify_stream(self, byte_stream: BytesIO) ...

2 participants