title: How to send file as response
body: <p>I am building a REST application with an use case in which client sends a GET request with some params and on server side the API process it and creates a tar file. At the end it should send this tar file to client, like auto download based on a query. Any help here?
  I am stuck after creation of tar file, not sure how can I send this file to client (like auto download)</p>
  <p>Sample code to emulate my question</p>
  <pre><code>func main() {
      http.HandleFunc(&quot;/&quot;, someHandle)
  
      port := &quot;:8080&quot;
      err := http.ListenAndServe(port, nil)
      if err != nil {
          log.Println(err)
      }
  
   }
  
  func someHandle(res http.ResponseWriter, req *http.Request){
       ...
       ... 
       some code 
       ...
       
       file, err := createFile(filePath)
       ...
       //Now I have to send this file as response, any thoughts?
  }
  </code></pre>