in the client side, i am converting a TypedArray into Blob and transmitting to server, to check if data is correct, i want to compare the first five values on client side and server side,
on client side:
var fileReader = new FileReader();
fileReader.onload = function() {
callback(new Int8Array(this.result));
};
fileReader.readAsArrayBuffer(blob);
(from which i read first five values in callback fn)
but on server, I found code to convert blob to buffer, and from my understanding, buffer
and arraybuffer
are not the same,
var buffer1 = new Buffer( blob, 'binary' );
does buffer have something similar to DataView
of arraybuffer, now how do I read the first 5 values of buffer1
as integers which I am able to do in client side?