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

enginebin

package
v0.46.0 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2026 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Package enginebin answers one question for the whole server: which of the heavy conversion programs — ffmpeg, ImageMagick, LibreOffice, Ghostscript, poppler, rsvg — are installed here, and which binary each one is.

Why there is exactly one answer

Until v0.43.0 two probes asked it separately and disagreed. The About page (internal/capability) counted ImageMagick as present when `magick` OR `convert` was on PATH; the app runtime (internal/wasmplugin) additionally checked that `convert` really was ImageMagick. On Windows `convert` resolves to C:\Windows\System32\convert.exe — the FAT→NTFS volume converter — so the About page said "ImageMagick: OK" while Apps and the converter said it was not installed (release-candidate sweep, 2026-09-21). Every screen now reads Probe(), so the answer a person sees cannot depend on which page they are looking at.

The probe runs once per process. Installing an engine therefore takes a restart to show up — on every screen at once, which is the point: a live re-probe on one page and a boot-time answer on another is the disagreement this package exists to remove.

Index

Constants

View Source
const (
	FFmpeg      = "ffmpeg"
	ImageMagick = "imagemagick"
	LibreOffice = "libreoffice"
	Ghostscript = "ghostscript"
	Poppler     = "poppler"
	RSVG        = "rsvg"
)

Engine ids. They are also the `engines:<id>` permission names a plugin asks for, so they never change spelling.

Variables

View Source
var Candidates = map[string][]string{
	FFmpeg:      {"ffmpeg"},
	ImageMagick: {"magick", "convert"},
	LibreOffice: {"soffice", "libreoffice"},
	Ghostscript: {"gs"},
	Poppler:     {"pdftoppm"},
	RSVG:        {"rsvg-convert"},
}

Candidates lists, per engine, the binaries that count as it, in order of preference.

⚠ ImageMagick: `magick` FIRST. It is the ImageMagick 7 entry point and the only name that is ImageMagick on every platform; `convert` is the legacy ImageMagick 6 name and, on Windows, a system tool that happens to share it.

Functions

func DisplayName

func DisplayName(id string) string

DisplayName is an engine as a person reads it — the product's own spelling. The id stays the machine's word (permissions, logs).

func Names

func Names() []string

Names lists every engine id, sorted.

func SetForTest

func SetForTest(available map[string]string) func()

SetForTest replaces the process-wide answer (nil = probe again on next use) and returns a function that puts the previous one back.

Types

type Set

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

Set is one probe's answer: engine id → resolved binary.

func Probe

func Probe() *Set

Probe is the server's one answer, computed on first use and kept for the life of the process.

func (*Set) Available

func (s *Set) Available() map[string]bool

Available is engine id → installed, for every known engine.

func (*Set) Has

func (s *Set) Has(engine string) bool

Has reports whether an engine is installed.

func (*Set) Missing

func (s *Set) Missing(engines []string) []string

Missing lists the given engine ids that are not installed, in the order given.

func (*Set) Path

func (s *Set) Path(engine string) string

Path is the binary an engine resolves to, "" when it is not installed.

Jump to

Keyboard shortcuts

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