How can i return a base64 as file on Deno Deploy?
Could someone give me an example for this?
7 Replies
can you explain what you’re trying to do?
I think this might be a https://xyproblem.info
The XY Problem
Asking about your attempted solution rather than your actual problem
I already found it, i basicly have to transform the base64 string into a file and then just provide it in the new Response 🙂
Could you share code for your solution? This may be useful to people in the future looking for how to do this as well...
Sure:
The first argument would be your base64 string, then it gets converted to the image using the second parameter as filename.
Then inside of your deploy function you can use:
This will return the file to the visitor of your deno deploy project
cool! thanks for sharing!
no problem!
the function dataURLtoFile comes somewhere from stackoverflow