function blobToString(blob) { var reader = new FileReader(); var d = \"\"; reader.onloadend = function() {
it should not be reader.onloadend but rather reader.onloaded
or try
reader.onload = function (e) { e.target.result -> this is the data. }