Skip to content

Add ext functions to file types #510

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

Merged
merged 2 commits into from
Feb 23, 2025

Conversation

giraffekey
Copy link
Contributor

@giraffekey giraffekey commented Feb 21, 2025

Adds two simple quality of life functions to FileType and MimeType.

FileType::Mpeg.ext(); // Some("mp3")
MimeType::Jpeg.ext(); // Some("jpg")

My use case is that I want to extract the pictures and save them separately to disk, so this saves me a manual pattern match on the extension of the file.

Copy link
Owner

@Serial-ATA Serial-ATA left a comment

Choose a reason for hiding this comment

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

Thanks for the PR!

I think having this on MimeType is fine, but it probably shouldn't be on FileType.

Co-authored-by: Alex <69764315+Serial-ATA@users.noreply.github.com>
@giraffekey
Copy link
Contributor Author

Makes sense.

@Serial-ATA
Copy link
Owner

Thanks!

@Serial-ATA Serial-ATA merged commit a438022 into Serial-ATA:main Feb 23, 2025
4 checks passed
@Serial-ATA Serial-ATA added this to the 0.22.3 milestone Apr 4, 2025
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.

2 participants