Support Topics Documentation Slack YouTube Blog

Decoding base64 to byte array in javascript

Hello everyone , I want your help in my issue , I want to decode my base64 string in backendless using javascript then save it in files but I did not find any solution .
This is my code please help.
const data=window.atob(car.Picture);
return Backendless.Files.saveFile( ‘test-ser’, “pic.png”, data, true );

Hello,

You can do this by creating an API service, pass the base64-encoded content as an argument, along with the name of the file, then in the API service, decode the value and use Backendless API to save in the file.

Regards,
Mark

Thanks for your reply , but the main problem is that there is no way to decode the base64-content . I had searched the backendless documentation I didn’t find any solution . Please if there is any way to decode the base64 encoded string let us know. Thanks in advance

If your API service is in JS, then all capabilities built into node are available to you. Here’s a stackoverflow discussion on how to do it in node: