bundle

package
v0.19.0 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package bundle provides functionality for bundling site files into the binary. Spec: deployment.md, executable-attrs.md CRC: crc-Bundle.md

Index

Constants

View Source
const (
	// MagicMarker identifies bundled binaries
	MagicMarker = "UISERVER"
	// FooterSize: 8 bytes magic + 8 bytes offset + 8 bytes size
	FooterSize = 24
)

Variables

View Source
var IGNORE_FILES = regexp.MustCompile(`^(|.*/)((#|\.#)[^/]*|[^/]*~)$`)

Functions

func CreateBundle

func CreateBundle(sourceBinary, siteDir, outputPath string) error

CreateBundle creates a new bundled binary. sourceBinary: path to the ui binary (can be bundled or unbundled) siteDir: directory containing site files outputPath: path for the bundled binary

func ExtractBundle

func ExtractBundle(targetDir string) error

ExtractBundle extracts bundled content to a directory.

func GetBinarySize

func GetBinarySize(binaryPath string) (int64, error)

GetBinarySize returns the size of the executable portion (excluding bundle). If bundled, returns the offset to the bundle. Otherwise returns total file size.

func GetBundleReader

func GetBundleReader() (*zip.Reader, error)

GetBundleReader returns a zip.Reader for the bundled content. Returns nil if the binary is not bundled.

func IsBundled

func IsBundled() (bool, error)

IsBundled checks if the current binary has bundled content.

func ListFiles

func ListFiles() ([]string, error)

ListFiles returns a list of files in the bundle.

func ListFilesInDir

func ListFilesInDir(dir string) ([]string, error)

ListFilesInDir returns files in a subdirectory of the bundle (non-recursive).

func ListFilesInDirRecursive added in v0.14.4

func ListFilesInDirRecursive(dir string) ([]string, error)

ListFilesInDirRecursive returns all files in a subdirectory of the bundle (recursive).

func ReadFile

func ReadFile(name string) ([]byte, error)

ReadFile reads a file from the bundle.

Types

type FileInfo added in v0.10.0

type FileInfo struct {
	Name          string      // File path within bundle
	IsSymlink     bool        // True if this is a symlink
	SymlinkTarget string      // Target path if symlink, empty otherwise
	Mode          fs.FileMode // File mode (permissions)
}

FileInfo contains metadata about a bundled file.

func ListFilesWithInfo added in v0.10.0

func ListFilesWithInfo() ([]FileInfo, error)

ListFilesWithInfo returns files with metadata including symlink information.

type Footer struct {
	Magic  [8]byte // "UISERVER"
	Offset int64   // Offset to start of ZIP data
	Size   int64   // Size of ZIP data
}

Footer contains metadata about the bundled ZIP

type ZipFileSystem

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

ZipFileSystem implements fs.FS for serving files from a ZIP archive. Files are served from the html/ subdirectory within the ZIP.

func NewZipFileSystem

func NewZipFileSystem(reader *zip.Reader) *ZipFileSystem

NewZipFileSystem creates a new ZipFileSystem from a zip.Reader. Files are served from the html/ subdirectory.

func NewZipFileSystemWithPrefix

func NewZipFileSystemWithPrefix(reader *zip.Reader, prefix string) *ZipFileSystem

NewZipFileSystemWithPrefix creates a ZipFileSystem with a custom prefix.

func (*ZipFileSystem) Open

func (zfs *ZipFileSystem) Open(name string) (fs.File, error)

Open implements fs.FS interface.

Jump to

Keyboard shortcuts

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