attachment

package
v0.1.2 Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2026 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeBase64

func DecodeBase64(input string, maxBytes int64) (io.Reader, error)

DecodeBase64 decodes both raw base64 and data URL base64 content. The returned reader is bounded to maxBytes+1 for caller-side size validation.

func MapMediaType

func MapMediaType(rawType string) media.MediaType

MapMediaType maps attachment type strings to media types.

func MimeFromDataURL

func MimeFromDataURL(raw string) string

MimeFromDataURL extracts MIME from a data URL.

func NormalizeBase64DataURL

func NormalizeBase64DataURL(input, mime string) string

NormalizeBase64DataURL normalizes raw base64 into a data URL.

func NormalizeMime

func NormalizeMime(raw string) string

NormalizeMime normalizes MIME to lowercase token form.

func PrepareReaderAndMime

func PrepareReaderAndMime(reader io.Reader, mediaType media.MediaType, sourceMime string) (io.Reader, string, error)

PrepareReaderAndMime reads a small prefix for MIME sniffing and replays it.

func ResolveMime

func ResolveMime(mediaType media.MediaType, sourceMime, sniffedMime string) string

ResolveMime resolves source MIME and sniffed MIME into final MIME.

Types

This section is empty.

Jump to

Keyboard shortcuts

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