assets

package
v0.4.4 Latest Latest
Warning

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

Go to latest
Published: Feb 5, 2022 License: AGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package assets provides functionality to load asset files that were packed into the binary during compilation.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bundler added in v0.4.0

type Bundler interface {
	Bundle(...NamedReader) error
}

Bundler is an interface for handling multi-file (de)serialization and creation of a http.FileSystem

type Environment added in v0.3.0

type Environment struct {
	Assets     afero.Fs
	Files      []NamedReader
	Downloader cdn.Downloader
}

Environment used to configure the behaviour of calls to the ssh library.

func (*Environment) Include added in v0.3.0

func (env *Environment) Include(options ...func(*Environment)) script.Option

Include the assets library in a script environment.

func (*Environment) Library added in v0.3.0

func (env *Environment) Library(options ...func(*Environment)) script.Library

Library prepares a new assets library for use within a script environment.

func (*Environment) Require added in v0.4.0

func (env *Environment) Require(filePath string) (err error)

Require will be used in the init function for the worker to specify which files you wish to include in the asset bundle which will be accessible on the target. Will fatal if error occurs.

@callable: assets.require @param: filePath @String

@usage: assets.require("file_on_cdn")

type NamedReader added in v0.4.0

type NamedReader struct {
	io.Reader
	Name string
}

NamedReader is a basic struct to organize the data needed for the Bundler

type TarGZBundler added in v0.4.0

type TarGZBundler struct {
	Buffer *bytes.Buffer
}

TarGZBundler is the concrete implementation of Bundle using Tar and GZip

func NewTarGZBundler added in v0.4.1

func NewTarGZBundler(files ...NamedReader) (*TarGZBundler, error)

NewTarGZBundler initializes a new tar bundler of the provided files.

func (*TarGZBundler) Bundle added in v0.4.0

func (tb *TarGZBundler) Bundle(files ...NamedReader) error

Bundle is used to add multiple files into a tar bundle

func (*TarGZBundler) FileSystem added in v0.4.0

func (tb *TarGZBundler) FileSystem() (afero.Fs, error)

FileSystem is used to convert a targz bundle into an in memory http.FileSystem

Jump to

Keyboard shortcuts

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