In the HTML5, it introduced the FileReader API. I can’t really understand the difference between readAsBinaryString() and readAsDataURL(). I read docs from several places, but still can’t fully understand. Can someone give some code examples to help me understand the differences?
In the HTML5, it introduced the FileReader API. I can’t really understand the difference
Share
If you use
readAsDataURL(), you get the data back in a data URI format. So something like the src attribute here:If you use
readAsBinaryString(), the result will be the raw bits. You can then use one of the low level binary APIs to manipulate the data or post it to the server.