We can use the net/http package to find the , or mime , of a . To do this, we open the and read the first 512 bytes (as the DetectContentType() function only uses the first 512 bytes, there’s no point in doing more than needed). This function will then return a mime type, like application/json or image/jpg for instance.



Source link

LEAVE A REPLY

Please enter your comment!
Please enter your name here