Good practices regarding MIME type
John Cowan
cowan at ccil.org
Thu Dec 10 21:23:07 GMT 2020
You can use the file(1) command or its library libmagic. These are
excellent for binary files and support some text file formats, and are
extensible. There are libmagic bindings for at least Perl, Python, Go,
Rust, Lua, Common Lisp, and Chicken Scheme.
On Thu, Dec 10, 2020 at 4:12 PM Solène Rapenne <solene at perso.pw> wrote:
> Hi,
>
> I wrote a gemini server in C and I currently use an hardcoded list of
> file extensions <-> MIME type assocation.
> This isn't great because it relies on file extension which can be wrong,
> but a file without extension would
> use a default.
>
> I chose to set a default text/gemini in case the extension is unknown or
> if the file has no extension.
>
> What are the good practices to determine a file MIME type?
>
> regards
> Solène
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.orbitalfox.eu/archives/gemini/attachments/20201210/2452b843/attachment.htm>
More information about the Gemini
mailing list