compression

package
v0.1.4 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2026 License: AGPL-3.0 Imports: 4 Imported by: 0

Documentation

Overview

Package compression provides HTTP compression utilities.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CompressGzip

func CompressGzip(data []byte, level int) ([]byte, error)

CompressGzip compresses data with the specified compression level. The level parameter should be one of the gzip constants (e.g., gzip.BestSpeed). Returns the compressed data or an error if compression fails.

func IsGzipped

func IsGzipped(data []byte) bool

IsGzipped checks if data is already gzip compressed. It checks for the gzip magic bytes (0x1f 0x8b) at the start of the data.

func SupportsGzip

func SupportsGzip(r *http.Request) bool

SupportsGzip checks if the client accepts gzip encoding. It inspects the Accept-Encoding header and returns true if gzip is supported.

Types

This section is empty.

Jump to

Keyboard shortcuts

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