API Reference Attached v#0.1.1

Copy Markdown View Source

Modules

File attachments for Ecto schemas.

Internal, schema-agnostic CRUD helpers used by Attached's context modules.

Changeset integration for attached fields.

Migrations create and modify the database tables Attached needs to function.

Macros for declaring file attachments on Ecto schemas.

Context module for originals.

Detects the real content type of a file by reading its magic bytes.

Oban worker that extracts metadata from an original and stores it.

Stores metadata about an uploaded file.

Oban worker that finds and purges orphaned originals.

Oban worker that asynchronously purges an original and its file from storage.

Aggregate statistics over attached_originals.

Registry and dispatch for image previewers.

Behaviour contract for image previewers that generate preview images from non-image files.

Generates a preview image from the cover of an EPUB file using epub-thumbnailer (Python script).

Generates a preview image from the cover of an EPUB file using gnome-epub-thumbnailer (C tool from the GNOME project, also handles MOBI).

Renders the first page of a PDF as a PNG using mutool from MuPDF.

Renders the first page of a PDF as a PNG using pdftoppm from poppler.

Generates a preview image from the first frame of a video file using ffmpeg.

Registry and dispatch for original metadata extractors.

Extracts duration and bit_rate from audio files using ffprobe (ships with ffmpeg).

Behaviour contract for extractors that pull metadata from uploaded files.

Extracts EPUB metadata via the bupe package. Pure Elixir, no system dependency.

Extracts width and height from image files using the ImageMagick identify CLI. Swaps dimensions for images rotated 90°/270° via EXIF.

Extracts width and height from image files using libvips via the vix package. Swaps dimensions for images rotated 90°/270° via EXIF.

Extracts width, height, duration, angle, display_aspect_ratio, and audio/video channel flags from video files using ffprobe (ships with ffmpeg).

Registry and dispatch for variant transformers.

Behaviour contract for variant transformers.

Document-to-markdown transformer using pandoc.

Image transformer backed by ImageMagick via the convert (v6) or magick (v7) CLI.

Image transformer backed by libvips via the vix package.

Resolves the Ecto repo used by Attached.

Facade for the configured storage backend.

Behaviour contract for storage backends.

Stores files on the local filesystem.

Test helpers for attached.

Context module for cached variant derivations of Attached.Originals.Original.

Raised when no transformer (direct or via the image previewer fallback) is available to produce a variant for the given content-type pair.

Oban worker that pre-processes a variant asynchronously.

Plug for serving files from disk storage.

Signs and verifies storage keys for secure URL generation.

Template helpers for rendering attachment URLs.

Mix Tasks

Generates an Ecto migration for an attached field on a schema.

Generates an Ecto migration that creates the attached_originals and attached_variants tables.