Help us shape the future of Go! Take the 2026 Go Developer Survey

files

package
v0.9.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type File

type File interface {
	Source() string
	Type() FileType
	Bytes() ([]byte, error)
	MIMEType() string
}

File provides access to file metadata and content.

func AudioFile

func AudioFile(path string) File

AudioFile creates a File backed by an audio file at the given path or URL.

func FromBytes

func FromBytes(name string, data []byte, detectedType FileType) File

FromBytes creates a File from raw byte data. If detectedType is TypeUnknown, auto-detection is run against the content.

func ImageFile

func ImageFile(path string) File

ImageFile creates a File backed by an image at the given path or URL.

func PDFFile

func PDFFile(path string) File

PDFFile creates a File backed by a PDF at the given path or URL.

func TextFile

func TextFile(path string) File

TextFile creates a File backed by a text file at the given path or URL.

func VideoFile

func VideoFile(path string) File

VideoFile creates a File backed by a video file at the given path or URL.

type FileType

type FileType string

FileType represents the type of file content.

const (
	TypeImage   FileType = "image"
	TypePDF     FileType = "pdf"
	TypeAudio   FileType = "audio"
	TypeVideo   FileType = "video"
	TypeText    FileType = "text"
	TypeUnknown FileType = "unknown"
)

Jump to

Keyboard shortcuts

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