SendFile

Transfers the file from the given path. Sets the Content-Type response HTTP header field based on the filenames extension.

Method use gzipping by default, set it to true to disable.

  1. func (c *Ctx) SendFile(file string, compress ...bool) error
  1. app.Get("/not-found", func(c *fiber.Ctx) error {
  2. return c.SendFile("./public/404.html");
  3. // Disable compression
  4. return c.SendFile("./static/index.html", false);
  5. })