Documentation
¶
Overview ¶
Package uploads is the canonical filesystem layout for files services produce on the local box: screenshots, generated images, PDFs, audit reports, anything else that needs to live somewhere predictable.
Convention:
$UPLOADS_ROOT/<service>/<bucket>/<filename>
where:
- $UPLOADS_ROOT defaults to $HOME/uploads (override via env)
- <service> is the producing service name (e.g. "go-wowa", "go-imagine", "vaelor")
- <bucket> is the producer's internal grouping ("screenshots", "carousels", "cards", "imagined", "pdf", "audio") — chosen by the producer, kept short
- <filename> is the actual file
Why a single pkg: every service was rolling its own /tmp/<svc>-* path pattern. Hard to find files, no shared retention policy, no operator overview. With this convention, `cd ~/uploads && ls` shows every service's recent output at a glance.
Usage:
dir, err := uploads.Bucket("go-wowa", "screenshots") // creates dir if needed
path := filepath.Join(dir, "abc.png")
Or one-shot:
path, err := uploads.Path("vaelor", "imagined", "sf-rooftop.png")
Index ¶
Constants ¶
const DefaultRootRel = "uploads"
DefaultRootRel is the path appended to $HOME when EnvRoot is unset.
const EnvRoot = "UPLOADS_ROOT"
EnvRoot is the env var name that overrides the default uploads root.
Variables ¶
This section is empty.
Functions ¶
func Bucket ¶
Bucket returns $UPLOADS_ROOT/<service>/<bucket> and creates it if missing. The standard call-site pattern.
func Path ¶
Path is a shortcut for filepath.Join(Bucket(service, bucket), filename). Returns the absolute path; the parent directory is created if missing. Filename is taken as-is, no sanitization — callers responsible for safety.
Types ¶
This section is empty.