Reputation: 23
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 {}
Upvotes: 1
Views: 4834
Reputation: 2740
You can try
console.log(String.fromCharCode.apply(null, new Uint16Array(rawData)));
Upvotes: 3
Reputation: 23
This is what'I've needed:
reader.readAsBinaryString(file);
then the data is available raw
Upvotes: 0