Wednesday, 3 May 2017

Node fs.readFileSync returns a uInt8 array instead of raw buffer array?

why is this:

var myArrayBuffer = fs.readFileSync(file, null)

returning an uInt8 array instead of a just a arrayBuffer? why does this seem to work?

var myArrayBuffer = fs.readFileSync(file, null).buffer;
var myAArray = new Uint16Array( myArrayBuffer.slice(266,(sizeofArray*sizeOfArrayElement));

Why would the fs.readFile parse my file into a uInt8 array? Makes no sense, the file has a bunch of different datatypes that are not 1 byte long.



via user2061883

No comments:

Post a Comment