media

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 19, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MediaTypeFromMIME

func MediaTypeFromMIME(contentType string) string

MediaTypeFromMIME maps a MIME type prefix to a media type string.

Types

type Service

type Service struct {
	// contains filtered or unexported fields
}

Service handles media file operations: saving, MIME detection, placeholder building.

func NewService

func NewService() *Service

NewService creates a Service with baseDir at ~/.openbee/media and ensures inbound/ exists.

func (*Service) BuildPlaceholder

func (s *Service) BuildPlaceholder(mediaType string, path string, fileName string) string

BuildPlaceholder builds a content placeholder string for embedding in message Content.

func (*Service) DetectMIME

func (s *Service) DetectMIME(data []byte, fileName string) string

DetectMIME detects the MIME type from file content bytes, falling back to extension-based mapping.

func (*Service) ExtensionFromMIME

func (s *Service) ExtensionFromMIME(contentType string) string

ExtensionFromMIME maps a MIME type to a file extension (with leading dot).

func (*Service) SaveInbound

func (s *Service) SaveInbound(_ context.Context, data []byte, ext string) (string, error)

SaveInbound writes data to ~/.openbee/media/inbound/<timestamp>-<uuid>.<ext> and returns the path.

Jump to

Keyboard shortcuts

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