source

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 27, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package source resolves image sources: file paths, data URIs, and remote URLs.

Index

Constants

View Source
const MaxRemoteBytes = 64 * 1024 * 1024

MaxRemoteBytes caps remote/data URI payloads to prevent OOM on hostile servers.

Variables

This section is empty.

Functions

This section is empty.

Types

type Kind

type Kind int

Kind tags how the source should be loaded.

const (
	KindFile Kind = iota
	KindBytes
)

type Resolved

type Resolved struct {
	Kind  Kind
	Path  string // when Kind == KindFile
	Bytes []byte // when Kind == KindBytes
}

Resolved is the resolver result. Exactly one of Path or Bytes is set.

func Resolve

func Resolve(ctx context.Context, src string) (*Resolved, error)

Resolve inspects src and returns either a file path or pre-loaded bytes. HTTP(S) URLs and data: URIs are fetched/decoded here; everything else is treated as a file path.

Jump to

Keyboard shortcuts

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