packer

package
v0.0.0-...-f1f97c7 Latest Latest
Warning

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

Go to latest
Published: Mar 6, 2018 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Asset

func Asset(toFile string, bytesData map[string][]byte) (int, error)

Asset writes bytes data to one file with base64 encoding

func Files

func Files(files []string, dirs []string) map[string][]byte

Files pack files source code to gzip

func Gzip

func Gzip(data []byte) ([]byte, error)

Gzip gzip bytes

func ReadAll

func ReadAll(r io.Reader, capacity int64) (b []byte, err error)

ReadAll is a copy from ioutil.ReadAll with capacity

func Unasset

func Unasset(fileStrings map[string]string) error

Unasset unpack files from source code

func Ungzip

func Ungzip(data []byte) ([]byte, error)

Ungzip decode compressed bytes

Types

type GzipPool

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

GzipPool manages a pool of gzip.Writer. The pool uses sync.Pool internally.

func (*GzipPool) GetReader

func (pool *GzipPool) GetReader(src io.Reader) (reader *gzip.Reader)

GetReader returns gzip.Reader from the pool, or creates a new one if the pool is empty.

func (*GzipPool) GetWriter

func (pool *GzipPool) GetWriter(dst io.Writer) (writer *gzip.Writer)

GetWriter returns gzip.Writer from the pool, or creates a new one with gzip.BestCompression if the pool is empty.

func (*GzipPool) PutReader

func (pool *GzipPool) PutReader(reader *gzip.Reader)

PutReader closes and returns a gzip.Reader to the pool so that it can be reused via GetReader.

func (*GzipPool) PutWriter

func (pool *GzipPool) PutWriter(writer *gzip.Writer)

PutWriter closes and returns a gzip.Writer to the pool so that it can be reused via GetWriter.

Jump to

Keyboard shortcuts

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