code: func DetectContentType(fileName string, f io.ReadSeeker) (string, error) {
  	ctype := mime.TypeByExtension(filepath.Ext(fileName))
  	if ctype != "" {
  		return ctype, nil
  	}
  
  	// save/rollback to get content probe from begin of file
  	currentPosition, err := f.Seek(0, io.SeekCurrent)
  	if err != nil {
  		return MimeOctetStream, fmt.Errorf("seeker can't seek, %s", err)
  	}
  
  	// read a chunk to decide between utf-8 text and binary
  	var buf [512]byte
  	n, _ := f.Read(buf[:])
  	ctype = http.DetectContentType(buf[:n])
  
  	_, err = f.Seek(currentPosition, io.SeekStart) // rewind to output whole file
  	if err != nil {
  		return MimeOctetStream, fmt.Errorf("seeker can't seek, %s", err)
  	}
  
  	return ctype, nil
  }
docs: // DetectContentType by file file extension, or fallback to content sniff