bundle

package
v0.8.1 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2021 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NormalizeStaticFilename added in v0.6.2

func NormalizeStaticFilename(fileName string) string

NormalizeStaticFilename will take various variations of a filename and normalize it to what is listed in the staticFile name cache on the Bundle struct

func Write

func Write(directive *directive.Directive, modules []os.File, staticFiles map[string]os.File, targetPath string) error

Write writes a runnable bundle based loosely on https://golang.org/src/archive/zip/example_test.go staticFiles should be a map of *relative* filepaths to their associated files, with or without the `static/` prefix.

Types

type Bundle

type Bundle struct {
	Directive *directive.Directive
	Runnables []WasmModuleRef
	// contains filtered or unexported fields
}

Bundle represents a Runnable bundle

func Read

func Read(path string) (*Bundle, error)

Read reads a .wasm.zip file and returns the bundle of wasm modules (suitable to be loaded into a wasmer instance)

func (*Bundle) StaticFile

func (b *Bundle) StaticFile(filePath string) ([]byte, error)

StaticFile returns a static file from the bundle, if it exists

type FileFunc

type FileFunc func(string) ([]byte, error)

FileFunc is a function that returns the contents of a requested file

type WasmModuleRef

type WasmModuleRef struct {
	Filepath string
	Name     string
	// contains filtered or unexported fields
}

WasmModuleRef is a reference to a Wasm module (either its filepath or its bytes)

func (*WasmModuleRef) ModuleBytes

func (w *WasmModuleRef) ModuleBytes() ([]byte, error)

ModuleBytes returns the bytes for the module

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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