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

add programmatic list of supported formats #452

Open
stonylohr opened this issue Nov 11, 2023 · 3 comments
Open

add programmatic list of supported formats #452

stonylohr opened this issue Nov 11, 2023 · 3 comments

Comments

@stonylohr
Copy link

First, thank you for creating and maintaining this project.

A feature that would make this library even more helpful to me would be some way to programmatically get a list of the supported file types. I know that the list is available in supported_mimes.md, but there are situations where it would be more convenient if there were an easy way to get the list directly from the package, rather than scraping the md file. I don't currently see a way to do that, though I might be overlooking something.

I'm flexible on many details, but my first thought would be to add an exported function (SupportedMIMEs()?) that returns root.flatten().

I would be happy to submit a PR for this feature, if we can figure out a general approach that works for both of us.

Thank you for considering.

@gabriel-vasile
Copy link
Owner

Hi @stonylohr

there are situations where it would be more convenient if there were an easy way to get the list directly from the package

Can you give some details about the use case and how the list of formats would help?

@stonylohr
Copy link
Author

Can you give some details about the use case and how the list of formats would help?

I have some packages that consume both this package and some other packages that similarly support a variety of formats. The set of fully supported formats ends up being the intersection of the formats supported by the consumed packages. While I wouldn't want to determine that list at runtime, I would be interested in creating a test that asserts that my list of fully supported formats is still current, so I can update it appropriately as packages evolve. Being able to ask your package for its list of supported formats would make it easier to ensure that I'm keeping things current on my end.

@aksdb
Copy link

aksdb commented Mar 8, 2024

Adding another use-case:
I want to implement an allow-list for file types being uploaded. That list should be configurable by the user. For that it would make sense, if I could offer the list of detected types via an API that does not easily deviate from the actual implementation.

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

3 participants