推荐的方法来检查文件是否已压缩/压缩

I am trying to check if an uploaded file ( no file extension) is compressed/ zipped. I searched through the fileinfo, fileheader etc but haven't found a way to do this. May be the magic number? Thanks

A quick-and-easy built-in way is with http.DetectContentType(). It does much more than just gzip/zip, but it's very fast because it doesn't check for too many things. If you want to check for a smaller set, and skip testing a string, check the source code in src/net/http/sniff.go and pull out the tests you want.