DynamicFileDef: Invokable<[file: IHttpFile], StaticFileDef>

Dynamic file definition that derives validation rules from the uploaded file itself.

Unlike StaticFileDef, this is an invokable function that receives the uploaded IHttpFile and returns a StaticFileDef with validation rules tailored to that specific file. Use this when constraints (such as allowed content type or maximum size) must be computed at runtime based on the file's properties.

const imageDef: DynamicFileDef = (file) => ({
contentType: file.mimeType ?? "image/png",
fileSize: { megabyte: 5 },
optional: false,
});

IMPORT_PATH: "@daiso-tech/core/http-router/contracts"