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
- Variables
- func CreateBundle(sourceBinary, siteDir, outputPath string) error
- func ExtractBundle(targetDir string) error
- func GetBinarySize(binaryPath string) (int64, error)
- func GetBundleReader() (*zip.Reader, error)
- func IsBundled() (bool, error)
- func ListFiles() ([]string, error)
- func ListFilesInDir(dir string) ([]string, error)
- func ListFilesInDirRecursive(dir string) ([]string, error)
- func ReadFile(name string) ([]byte, error)
- type FileInfo
- type Footer
- type ZipFileSystem
Constants ¶
const ( // MagicMarker identifies bundled binaries MagicMarker = "UISERVER" FooterSize = 24 )
Variables ¶
var IGNORE_FILES = regexp.MustCompile(`^(|.*/)((#|\.#)[^/]*|[^/]*~)$`)
Functions ¶
func CreateBundle ¶
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 ¶
ExtractBundle extracts bundled content to a directory.
func GetBinarySize ¶
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 ¶
GetBundleReader returns a zip.Reader for the bundled content. Returns nil if the binary is not bundled.
func ListFilesInDir ¶
ListFilesInDir returns files in a subdirectory of the bundle (non-recursive).
func ListFilesInDirRecursive ¶ added in v0.14.4
ListFilesInDirRecursive returns all files in a subdirectory of the bundle (recursive).
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
ListFilesWithInfo returns files with metadata including symlink information.
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.