media

package
v0.1.11 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2026 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	MaxAttachments = 4
	MaxImageBytes  = 5 << 20
	MaxGIFBytes    = 15 << 20
	MaxVideoBytes  = 512 << 20
)

Variables

This section is empty.

Functions

func HumanBytes

func HumanBytes(n int) string

func NormalizePath

func NormalizePath(input string) (string, error)

Types

type Attachment

type Attachment struct {
	ID     string
	Name   string
	Source Source
	Path   string
	MIME   string
	Format string
	Width  int
	Height int
	Size   int64
	Data   []byte
}

func FromClipboard

func FromClipboard(data []byte) (Attachment, error)

func FromPath

func FromPath(input string) (Attachment, error)

func (Attachment) IsVideo

func (a Attachment) IsVideo() bool

IsVideo reports whether the attachment streams from disk as video rather than travelling in Data as an image.

type Source

type Source string
const (
	SourceClipboard Source = "clipboard"
	SourceFile      Source = "file"
)

Jump to

Keyboard shortcuts

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