Source File
config.go
Belonging Package
github.com/gofiber/fiber/v2/middleware/compress
package compressimport ()// Config defines the config for middleware.type Config struct {// Next defines a function to skip this middleware when returned true.//// Optional. Default: nilNext func(c *fiber.Ctx) bool// Level determines the compression algorithm//// Optional. Default: LevelDefault// LevelDisabled: -1// LevelDefault: 0// LevelBestSpeed: 1// LevelBestCompression: 2Level Level}// Level is numeric representation of compression leveltype Level int// Represents compression level that will be used in the middlewareconst (LevelDisabled Level = -1LevelDefault Level = 0LevelBestSpeed Level = 1LevelBestCompression Level = 2)// ConfigDefault is the default configvar ConfigDefault = Config{Next: nil,Level: LevelDefault,}// Helper function to set default valuesfunc configDefault( ...Config) Config {// Return default config if nothing providedif len() < 1 {return ConfigDefault}// Override default config:= [0]// Set default valuesif .Level < LevelDisabled || .Level > LevelBestCompression {.Level = ConfigDefault.Level}return}
![]() |
The pages are generated with Golds v0.6.7. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @Go100and1 (reachable from the left QR code) to get the latest news of Golds. |