# @angelo/zfd Extra schema for validating FormData on Zod & Zod mini 4+ Bundles ~0.7kb uncompressed; ~0.4kb gzip / brotli ## Usage > [!NOTE] > While the content of the library might be usable, this readme is still work in progress. If you're using `zod/v4/mini` and want to validate `FormData` server-side (not in-browser): ```ts import { z } from "zod/v4/mini"; import * as zf from "@angelo/zfd/mini-formdata"; // Describe the fields in the `FormData` // like a normal object. // //`FormData` values can only be `string | File`. const schema = zf.formData( name: z.string().check(z.minLength(2)), // Field `age` here will be a stringified number. // Look into `numeric` in `@angelo/zfd/mini-dom` // or use Zod's codecs age: z.string(), image: z.optional(z.file()), ); ``` ## Spec-compliance Schema exported from this libary may not perfectly comply with `FormData`'s specification. More specifically: - `FormData`'s specification allows for multiple fields with the same key. This library's schema will only use the latest / bottom-most entry in the `FormData`. ## Development - Install dependencies: ```bash pnpm install ``` - Run development mode: ```bash pnpm dev ``` - Run the unit tests: ```bash pnpm test ``` - Build the library: ```bash pnpm build ```