zod icon indicating copy to clipboard operation
zod copied to clipboard

Build in File and FileList Support

Open iamalipe opened this issue 2 years ago • 2 comments

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"])

iamalipe avatar Oct 07 '23 04:10 iamalipe

Hey, I've created a PR for this and happy to hear from you. https://github.com/colinhacks/zod/pull/3118

kaciakmaciak avatar Jan 07 '24 12:01 kaciakmaciak

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)

colinhacks avatar Apr 29 '24 23:04 colinhacks