What are the options in case we would need to upload a file or post any other binary data? #1442
Answered
by
KATT
danechitoaie
asked this question in
Q&A
-
Would this be possible? Is there any way a mutation can support binary data as input? Or we would need to fallback to a REST endpoint for this? |
Beta Was this translation helpful? Give feedback.
Answered by
KATT
Jan 22, 2022
Replies: 1 comment
-
tRPC is JSON-only in it's current form so you'll have to either serialize the data to a base64 string or do a REST-ish-endpoint. Data isn't streamed to the resolvers so something like big uploads would be quite inefficient in the suggestion I'm describing (also base64 adds overhead). That said, I've done this plenty and it works really well as a quick solution that can be revisited later. |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
tianhuil
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
tRPC is JSON-only in it's current form so you'll have to either serialize the data to a base64 string or do a REST-ish-endpoint.
Data isn't streamed to the resolvers so something like big uploads would be quite inefficient in the suggestion I'm describing (also base64 adds overhead). That said, I've done this plenty and it works really well as a quick solution that can be revisited later.