Skip to content Skip to sidebar Skip to footer

Convert Binary Data To Base-64 Javascript

I have a problem to convert binary data to base-64 in JS. I try all the things that exists on the net include this How to parse into base64 string the binary image from response?,

Solution 1:

Here is the link to this small library that is meant can be useful for u. It can convert base64 to binary and vice versa.

Solution 2:

My problem is solved . I use dropzone plugin to get the response from server and because of this I get binary data as a text reponse and it make my problems. I just go to dropzone.js and change 2 minor things to get the response in type of arraybuffer :

xhr.responseType = 'arraybuffer'; ( line 1246)

This is new line to get the response in type of arrayBuffer, and then create a Blob object from the arraybuffer response .

response = xhr.response; (line 1305 ) 

Change it to get response inseted TextRrsponse..

I hope that it will help somebody... Thanks everyone !

Post a Comment for "Convert Binary Data To Base-64 Javascript"