compress

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 10, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package compress gzips a Tern app's dynamic responses (pages, data, endpoint JSON) for clients that accept it:

ternApp(kit.WithPlugins(compress.New()))

Static assets are already precompressed by tern build and are left alone. Flushes pass through, so streamed data still arrives as soon as it resolves.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Option

type Option func(*Plugin)

Option configures the plugin.

func Level

func Level(level int) Option

Level sets the gzip level. The default is gzip.DefaultCompression.

func MinSize

func MinSize(n int) Option

MinSize skips responses that declare a Content-Length below n bytes. The default is 512.

type Plugin

type Plugin struct {
	// contains filtered or unexported fields
}

Plugin compresses responses. Create it with New.

func New

func New(opts ...Option) *Plugin

New returns the compression plugin.

func (*Plugin) Name

func (*Plugin) Name() string

Name implements kit.Plugin.

func (*Plugin) Setup

func (p *Plugin) Setup(s *kit.Setup) error

Setup implements kit.Plugin.

Jump to

Keyboard shortcuts

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