filecontent

package
v0.8.3 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ImageBase64

func ImageBase64(img *Image) string

ImageBase64 returns a data URL suitable for OpenAI-style vision APIs.

func IsImage

func IsImage(name string, data []byte) bool

IsImage reports whether the filename or magic bytes look like a supported image.

func Read

func Read(path string, maxBytes int64) (string, error)

Read extracts human-readable text from a file for agent context. Supports UTF-8 text files and PDF documents (text layer only).

func ReadBytes

func ReadBytes(name string, data []byte, maxBytes int64) (string, error)

ReadBytes extracts text from raw file bytes using the filename hint for format detection.

Types

type Image

type Image struct {
	MimeType string
	Data     []byte
}

Image holds raw image bytes for vision models.

func ReadImage

func ReadImage(path string) (*Image, error)

ReadImage loads a supported image file for vision APIs.

func ReadImageBytes

func ReadImageBytes(name string, data []byte) (*Image, error)

ReadImageBytes parses image bytes using the filename extension as a hint.

Jump to

Keyboard shortcuts

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