It there a built-in way to get a file type in Go?
Is it sufficient to guess from the filename alone (in Windows) or is there a way to tell only basically if the file is, say, an executable file? I'd like to find a cross-platform method of doing this, and reading a filename and working from that may miss executable files that are renamed to *.jpg.
You can either use MIME type guessing using mime.TypeByExtension or http.DetectContentType from the standard library or use third-party libmagic
bindings, e.g. magicmime.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With