You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have probably just a simple question. I didn't find it in the Documentation. And I tried different syntaxes but never worked.
How do you extract a Blob from an Eden response?
I.e. if you have an endpoint returning an Image body:
// In FETCH:constresponse=awaitfetch(`/readfile/${encodeURIComponent(path)}`);// TODO: This has the .blob(); that idk how to use in Eden. if(response.ok){constblob=awaitresponse.blob();setImage(blob);}// In EDEN:// const response = await server.readfile[encodeURIComponent(path)].get();// ??
By default Eden would try to parse the response body and put it to response.data. It is not hundred percent accurate, for some cases we can use onResponse in eden treaty config to intercept responses and parse it the way we want to.
In my case I am returning FormData from elysia endpoint, but Eden only parses the form fields using get. The field named image can contain one or more images so I intercept the response and unwrap the File/Blob using getAll:
Hello!
First of all, I love this library. Very nice.
I have probably just a simple question. I didn't find it in the Documentation. And I tried different syntaxes but never worked.
How do you extract a Blob from an Eden response?
I.e. if you have an endpoint returning an Image body:
For context, setImage is used like this in React
The text was updated successfully, but these errors were encountered: