# `Image.Plug.VariantStore.Persistence.File`
[🔗](https://github.com/elixir-image/image_plug/blob/v0.1.0/lib/image/plug/variant_store/persistence/file.ex#L1)

JSON-on-disk variant persistence backend.

Serialises variants as a single JSON file containing a top-level
array of variant objects:

    [
      {
        "name": "thumbnail",
        "options": "width=200,height=200,fit=cover,format=webp",
        "metadata": {"description": "card thumbnail"},
        "never_require_signed_urls": false,
        "inserted_at": "2026-04-26T12:34:56Z",
        "updated_at": "2026-04-26T12:34:56Z"
      },
      ...
    ]

Whole-file rewrites on every `write/4` (atomic via
write-temp-then-rename). Suitable for stores up to a few thousand
variants; for larger or higher-write-rate workloads, plug a
database-backed implementation in instead.

### Configuration

    variant_store: {Image.Plug.VariantStore.ETS, [
      persistence: {
        Image.Plug.VariantStore.Persistence.File,
        path: "/var/lib/image_plug/variants.json",
        provider: Image.Plug.Provider.Cloudflare  # default
      }
    ]}

### Options

* `:path` (required) — absolute filesystem path. The directory
  must exist; the file is created if absent.

* `:provider` — module used to re-parse persisted options
  strings at load time. Defaults to
  `Image.Plug.Provider.Cloudflare`.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
