zod
zod copied to clipboard
Build in File and FileList Support
Add a support for File and FileList.
example
const size = 10000 // byte
z.flle().size(10000).allowType(["image/jpeg","image/png"])
z.fileList().min(1).max(10).size(10000).allowType(["image/jpeg","image/png"])
Hey, I've created a PR for this and happy to hear from you. https://github.com/colinhacks/zod/pull/3118
This PR has landed in the v4 branch but it may take some time before it lands in a stable release. In the meantime, I recommend z.instanceof:
z.instanceof(File)