Skip to content
Advertisement

How to convert blob url to a byte array using javascript only

I have blob url , i need to get it converted into a byte [] for storing purpose . I initially tried converting it to a base64 using FileReader

JavaScript

Then used following to convert it to an array

JavaScript

But I do not get the intended binary output ..

Advertisement

Answer

I managed to achieved this, and it might not be the suitable way, but I’m posting it here in case someone else might find it useful.

What I have is a blob URL, and

JavaScript

Also, I had to do a modification to my jQuery service call; I had to add processData: false , otherwise, passing the array will be processed, and in my case, the service failed to de-serialize it.

JavaScript

Cheers

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement