1
          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 guess my intentions are clear, I want to convert some binary data(WebKitBlobBuilder) to a string. Also the "console.log(reader.result);" doesn't display anything.

1
  • How are you calling blobToString? Commented Jul 31, 2011 at 4:46

2 Answers 2

2

Check out http://blog.ericzhang.com/state-of-binary-in-the-browser/ and his binary.js project.

Sign up to request clarification or add additional context in comments.

1 Comment

These links as answers are rarely useful. This one especially isn't - too much text to read on that page. Which section is applicable?
0

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

or try

reader.onload = function (e) {
e.target.result -> this is the data. 
}

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.