elysiajs / eden

Fully type-safe Elysia client
MIT License
174 stars 41 forks source link

How to upload a file using eden treaty? #28

Closed terminal-ator closed 1 year ago

terminal-ator commented 1 year ago

While the documentation made clear that how to use get and post simple json, there are no example on how to post a file using it, and its not clear on how to approach that. Using formdata as body failed for me. So a better documentation depicting how to make it work would be great.

jjhiggz commented 1 year ago

I'm not sure you're supposed to use eden treaty for that. For comparison it doesn't seem like tRPC supports that, I wonder if edenFetch would be a better fit for that, although I haven't tried

SaltyAom commented 1 year ago

You can pass either File or FileList from value of `, see Treaty File Example