packer

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Overview

Package packer implements the core packing functionality. It is designed to be used by a wrapper program (CLI etc.).

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Pack

func Pack(filesToPack FilesToPack, outputFilename string) error

Pack a file. Use Pack2 for progress reporting.

func Pack2 added in v1.1.0

func Pack2(filesToPack FilesToPack, outputFilename string, progress Progress) error

Pack2 will pack a file, with progress reporting. The progress interface may be nil.

Types

type FileToPack

type FileToPack struct {
	// Filename is the path to the file on disk (relative or absolute).
	Filename string `yaml:"filename"`

	// ContentType is used as the Content-Type header for the source data.
	ContentType string `yaml:"content_type"`

	// DisableCompression can be set to skip any compression for this file.
	DisableCompression bool `yaml:"disable_compression"`

	// DisableGzip can be set to skip gzip compression for this file.
	DisableGzip bool `yaml:"disable_gzip"`

	// DisableBrotli can be set to skip brotli compression for this file.
	DisableBrotli bool `yaml:"disable_brotli"`
}

FileToPack contains the headers / options for a file which is about to be packed.

type FilesToPack

type FilesToPack map[string]FileToPack

FilesToPack is the set of files which will be incorporated into the packfile. The key is the path at which the file will be served, and the value gives the disk filename as well as headers / options.

type Progress added in v1.1.0

type Progress interface {
	// Count reports the number of items that have begun processing.
	Count(n int)

	// Begin denotes the processing of an input file.
	Begin(filename, compression string)

	// End denotes the completion of input file processing.
	End(filename, compression string)
}

Progress is a callback object which reports packing progress.

Jump to

Keyboard shortcuts

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