zip

package
v0.0.0-...-381b1be Latest Latest
Warning

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

Go to latest
Published: Mar 21, 2024 License: MIT Imports: 8 Imported by: 0

README

zip

-- import "github.com/dockerian/go-coding/pkg/zip"

Package zip :: gzip.go - gzip writer and handler

GZipHandler constructs a http handler wrapper to add gzip compression. See https://gist.github.com/bryfry/09a650eb8aac0fb76c24

Package zip :: zip.go - zip extensions

Usage

func CreateZip
func CreateZip(sources []*Source, w io.Writer) error

CreateZip copies from multiple sources to a writer

func GZipHandler
func GZipHandler(next http.Handler) http.Handler

GZipHandler wrap a http.Handler to support transparent gzip encoding

type GZipResponseWriter
type GZipResponseWriter struct {
	io.Writer
	http.ResponseWriter
}

GZipResponseWriter struct wraps an io.Writer and http.ResponseWriter

func (*GZipResponseWriter) Write
func (gzw *GZipResponseWriter) Write(bytes []byte) (int, error)

Write implements io.Writer

type Source
type Source struct {
	io.Reader
	Name string
	Size int
}

Source defines a zip reader struct with name and reader

Documentation

Overview

Package zip :: gzip.go - gzip writer and handler

GZipHandler constructs a http handler wrapper to add gzip compression. See https://gist.github.com/bryfry/09a650eb8aac0fb76c24

Package zip :: zip.go - zip extensions

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateZip

func CreateZip(sources []*Source, w io.Writer) error

CreateZip copies from multiple sources to a writer

func GZipHandler

func GZipHandler(next http.Handler) http.Handler

GZipHandler wrap a http.Handler to support transparent gzip encoding

Types

type GZipResponseWriter

type GZipResponseWriter struct {
	io.Writer
	http.ResponseWriter
	// contains filtered or unexported fields
}

GZipResponseWriter struct wraps an io.Writer and http.ResponseWriter

func (*GZipResponseWriter) Write

func (gzw *GZipResponseWriter) Write(bytes []byte) (int, error)

Write implements io.Writer

type Source

type Source struct {
	io.Reader
	Name string
	Size int
}

Source defines a zip reader struct with name and reader

Jump to

Keyboard shortcuts

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