title: How to server a file from a handler in golang
body: <p>I was wondering how to serve a file from a handler. I'm using <a href="http://golang.org" rel="noreferrer">go</a> and <a href="http://github.com/gin-gonic/gin" rel="noreferrer">gin</a> and I've tried to do.</p>
  
  <pre><code>func DownloadHandler(c *gin.Context) {
     c.File("./downloads/file.zip")
  }
  </code></pre>
  
  <p>and </p>
  
  <pre><code>func DownloadConfigs(c *gin.Context) {
     http.ServeFile(c.Writer, c.Request, "./downloads/file.zip")
  }
  </code></pre>
  
  <p>and both of those solutions without the dot as well.</p>
  
  <p>I'm open to any solution and because gin is compatible with the standard http lib, I can use non-gin specific solutions as well</p>