attachments

package
v1.14.0 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2026 License: MIT Imports: 14 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 ContentOpensInViewer added in v1.8.1

func ContentOpensInViewer(filename, contentType string) bool

ContentOpensInViewer reports whether a file called filename whose contents a sniffer named contentType is still a document, image or media file, so an opener that chooses by contents shows it rather than runs it.

func Destination

func Destination(outputPath, filename string) (string, error)

func IsHEYBlobURL added in v1.4.3

func IsHEYBlobURL(source string) bool

IsHEYBlobURL reports whether source is a clean relative path to HEY's blob storage.

func OpensInViewer added in v1.8.1

func OpensInViewer(filename string) bool

OpensInViewer reports whether an attachment called filename is a kind of file the system shows in a viewer, so it is safe to open directly. Other attachments can still be saved and opened deliberately.

func PortableFilename

func PortableFilename(filename string) (string, error)

func Save

func Save(ctx context.Context, downloader Downloader, destination, sourceURL string, force bool) (int64, error)

func SaveBytes added in v0.2.0

func SaveBytes(destination string, data []byte, force bool) (int64, error)

SaveBytes safely writes data to destination. Existing paths are preserved unless force is set.

Types

type Downloader

type Downloader interface {
	DownloadBlob(context.Context, string, io.Writer) (int64, http.Header, error)
}

Jump to

Keyboard shortcuts

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