1
    var reader = new FileReader();
    var rawData = new ArrayBuffer();            
    //console.log(1);

    reader.onload = function(e) {


        var rawData = e.target.result; //binary data
        console.log(rawData);


    }

I want to see explicitly the binary raw data as a text string, is that possible?, cause the only thing i see when logging is:

ArrayBuffer {} 
3
  • so the rawData is in the form 1,0,1,1,0,1? and you want it like 101101? Commented Sep 10, 2014 at 11:47
  • @AbdulJabbar anyhow just to print it and see it explicitly Commented Sep 10, 2014 at 11:49
  • 1
    I think you need to use one of the FileReader methods to read the data first. devdocs.io/dom/filereader Commented Sep 10, 2014 at 12:26

2 Answers 2

3

You can try

console.log(String.fromCharCode.apply(null, new Uint16Array(rawData)));
Sign up to request clarification or add additional context in comments.

Comments

0

This is what'I've needed:

reader.readAsBinaryString(file);

then the data is available raw

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.