Skip to content
Discussion options

You must be logged in to vote

Hello, @lanwin .

In order to receive the whole request body as a binary stream, see raw data processing:
https://github.com/RobinTail/express-zod-api#accepting-raw-data

If possible, consider also regular file uploads instead:
https://github.com/RobinTail/express-zod-api#file-uploads

In order to stream the image in response, see the example of custom ResultHandler:
https://github.com/RobinTail/express-zod-api#non-object-response

But then how to use an zod input object with that?

  • For endpoint input schema use ez.raw() which is an alias for z.object({ raw: z.file().buffer() }) — you will need to adjust you config with rawParser option in order to make this little trick work. This feature …

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by RobinTail
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants