compression

package module
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 2, 2020 License: MIT Imports: 2 Imported by: 5

README

Compression

Release Discord Test Security Linter

Install
go get -u github.com/gofiber/fiber
go get -u github.com/gofiber/compression
Example
package main

import 
  "github.com/gofiber/fiber"
  "github.com/gofiber/compression"
)

func main() {
  app := fiber.New()

  app.Use(compression.New())

  app.Get("/", func(c *fiber.Ctx) {
    c.Send("Welcome!")
  })

  app.Listen(3000)
}

Documentation

Index

Constants

View Source
const (
	LevelNoCompression         = -1
	LevelDefaultCompression    = 0
	LevelBestSpeed             = 1
	LevelBestCompression       = 2
	LevelHuffmanOnly           = 3
	LevelDefaultBrotli         = 4
	LevelBrotliBestSpeed       = 5
	LevelBrotliBestCompression = 6
)

Supported compression levels

Variables

This section is empty.

Functions

func New

func New(config ...Config) func(*fiber.Ctx)

New ...

Types

type Config

type Config struct {
	// Filter defines a function to skip middleware.
	// Optional. Default: nil
	Filter func(*fiber.Ctx) bool
	// Level of compression
	// Optional. Default value 0.
	Level int
}

Config ...

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL