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

Feature: Functions for specific doc types #189

Open
onetwopunch opened this issue Sep 27, 2021 · 0 comments
Open

Feature: Functions for specific doc types #189

onetwopunch opened this issue Sep 27, 2021 · 0 comments

Comments

@onetwopunch
Copy link

First off, I want to say thank you for your hard work on this project! I'm transitioning my critical path code from h2non/filepath to mimetype due to your better support for MSO files. I did have a feature request though that would make my life much easier, and I'm assuming others as well:

filetype has a few really nice aggregate functions that tell you if a file is a document, compressed, image, etc. Here's an example. I think with the tree structure you have, you could even make this dynamic by constructing the tree with something like namespaces. Or you could simply have a manual list of all the file types you support. Or even have a tag field on your structure.

There's lots of options, but generally I'd love to see the ability to ask mimetype if a file is of a compressed type without having to hard-code a list of mimetypes that are compressed.

Something like:

mt := mimetype.Detect(buffer)
if mt.IsCompressed() {
   // Do something
} else if mt.IsImage() {
  // Do something else
}
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

1 participant