Is it possible to somehow return a buffer/blob/file from a server action?
Unanswered
American posted this in #help-forum
AmericanOP
question is in the title π Now I had to make a route handler just for the file, but I dislike losing the type-safety provided by server actions.
9 Replies
Sure you can whats stopping you?
It needs to be json parsable if I remember correctly
Just convert the file to base64 and then convert it back to a blob
If I remember correctly converting the base64 will make the network transfer about 30% larger over the wire, or something along those lines.
@Jboncz Just convert the file to base64 and then convert it back to a blob
AmericanOP
But I want the bytes, the binary π
Convert it back?
Itβs not a one way street
I donβt know of a more streamlined approach.
While utilizing server actions.