File uploads (withFiles + Sharp + R2)
Generated from
mcp/patterns.registry.json— do not edit by hand; change the registry and runbun run patterns:build.
Index card — the docs below are the canonical explanation; deep-tier pattern pages additionally carry invariants and emulation notes.
Category: Forms & Validation · Tier: light · Risk: medium — server-side file handling (sharp, r2 storage)
Server-side file upload handling that processes images with Sharp and persists them to Cloudflare R2, validating file metadata via Valibot rather than the file bytes themselves in-schema.
When to use: Use when a form needs to accept file uploads (e.g. images) that are processed and stored server-side.
Docs
Code
Machine-readable record: forms-file-uploads in mcp/patterns.registry.json.