Arraybuffer to blob.
npm install -S @jswork/next-arraybuffer2blob
import '@jswork/next-arraybuffer2blob';
socket.onmessage = function(msg) {
var arrayBuffer = msg.data;
var blob = nx.arraybuffer2blob(arrayBuffer);
var image = document.getElementById('image');
var reader = new FileReader();
reader.onload = function(e) {
// base64
image.src = e.target.result;
};
reader.readAsDataURL(blob);
};
Code released under the MIT license.