Replies: 1 comment 3 replies
-
@jsoneaday Hi, Sorry for the delay on this (have just been catching up on things and noticed this went unanswered)
There's a few ways you could type this response (and if const T = Type.Object({
avatar: Type.String({ contentEncoding: 'base64' })
}) This would require your Fastify route to base64 encode the image data prior to sending. Note also, when using Fastify, you should only use types prefixed with Generally, it's good to keep in mind the transmission format (Json in this case) when constructing the type, There are alternative formats (like msgpack, cbor) that do support actual binary encoding, but if using the default Fastify pipeline, it's better to limit the types to those representable in that pipeline. Hope this helps |
Beta Was this translation helpful? Give feedback.
-
I am using Node/Fastify and Postgres. I would like to receive bytea from my postgres db and reply with a blob, arraybuffer, etc. In other words I need to return a file, but use the Fastify schema like this. It seems there is a type Any but is this the correct type to use?
Beta Was this translation helpful? Give feedback.
All reactions