embed

package
v0.28.1 Latest Latest
Warning

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

Go to latest
Published: Oct 13, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Overview

Package embed compiles static @embed declarations to typed xfile.Ref values. It never puts asset bytes into Flow metadata or runtime state.

Index

Constants

View Source
const (
	ID              = "embed"
	DefaultProvider = "flow.static"
	DefaultMaxBytes = int64(16 << 20)
)

Variables

This section is empty.

Functions

func Bundle

func Bundle(opts map[string]string) compiler.Bundle

Bundle creates the standard extension bundle. The optional "root" setting names a filesystem directory, "provider" selects the xfile provider label, and "max_size" limits the maximum bytes read at compile time and runtime. No implicit process working-directory root is used.

func NewBundle

func NewBundle(fsys fs.FS, provider string, maxBytes int64) compiler.Bundle

NewBundle binds the directive to an explicitly declared fs.FS root. This is the preferred integration point for embedded or otherwise sandboxed filesystems.

Types

type Resolver

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

Resolver serves only assets declared during preprocessing. References are mapped through opaque IDs to validated relative paths and are integrity-checked on every open; bytes are bounded by maxBytes and are not retained.

func BundleWithFileResolver

func BundleWithFileResolver(fsys fs.FS, provider string, maxBytes int64) (compiler.Bundle, *Resolver)

BundleWithFileResolver returns an embed bundle and its FS-backed resolver. The bundle registers the resolver so runner.BuildConfig composes it with other provider bindings automatically.

func (*Resolver) Open

func (r *Resolver) Open(ctx context.Context, ref xfile.Ref) (io.ReadCloser, xfile.Info, error)

Jump to

Keyboard shortcuts

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