Convert BlobBuilder to String, in HTML5 Javascript

function blobToString(blob) { var reader = new FileReader(); var d = ""; reader.onloadend = function() { d.callback(reader.result); console.log(reader.result); }; reader.readAsText(blob); return d; }; 

The above code does not work, but I think my intentions are clear, I want to convert some binary data (WebKitBlobBuilder) to a string. Also "console.log (reader.result)"; nothing is displayed.

+1
javascript string html5 blob
Jul 31 '11 at 1:12
source share
2 answers
+2
Oct. 15 '12 at 1:25
source share

it should not be reader.onloadend, but rather reader.onloaded

or try

 reader.onload = function (e) { e.target.result -> this is the data. } 
0
May 2 '13 at 20:01
source share



All Articles