The uploading images API needs binary stream. I've tried new FileReader()
and its readAsBinaryString()
method, but it doesn't work! It seems that binary string and binary stream are not the same thing, so I changed my way and tried readAsDataURL()
method (cause I need to preview images) and now I want to know:
1) how to convert base64
into binary stream using js?
When I use readAsBinaryString()
,the respond is as follow (data A):
But the API needs something like this (data B):
2) Anybody know how to convert dataA ( picture above ) into dataB ( picture down )?