fd
fd copied to clipboard
Adding mimetype support
Like in xdg-mime query filetype some-video.webm
displaying video/webm
, parameters could be -M video
, -m webm
or something.
Would that be possible? I quess it would hurt performance.
I was always wondering, Linux Desktop is mimetype based first, file extension second. But the good old command line tools are always string only.
Have missed this feature often in find
.
I'm looking to make some contributions, is this a feature that makes sense for fd? (I understand it's not trying to be a complete find replacement).
There are a couple of different approaches to listing the mime type discussed here: https://github.com/bojand/infer/issues/24
I've got an example implementation that would use first attempt to get the mimetype using infer (magic number), and then falling back to the file extension database using mime_guess: https://github.com/xweskingx/fd/pull/1/commits/8400b88270d3491738bd1afd5c0d1bc86f92ed47
To be honest, I'm rather leaning towards declining this feature request. But see #400 for a discussion on a more generic version of this.