covenix / File
Function: File()
File(
name):ParameterDecorator
Defined in: src/parameters.ts:123
Injects a single uploaded file from a multipart/form-data request as a web-standard File. Pairs with a z.file() field in the @Body schema (its presence is what makes the route multipart); the file is validated against that schema's constraints before the handler runs.
Parameters
name
string
The form field name (an object key in the @Body schema).
Returns
ParameterDecorator
Example
ts
@Body(z.object({ avatar: z.file().max(2_000_000) }))
upload(@File('avatar') avatar: File) {}