vendredi 27 février 2015

Fill a typed array with .bin file content in Node.js

On my server file system I have a directory which contains some .bin file filled with 16 bit integers. How can I load a Uint16Array variable with the content of a specific .bin file in Node.js?

I already tried:

var arrayFromBinFile = new Uint16Array('./myDirectoryContainingBinFiles/selectedFile.bin')

By using console.log in node.js all I get is:

{ BYTES_PER_ELEMENT: 2,

get: [Function: get],

set: [Function: set],

slice: [Function: slice],

subarray: [Function: subarray],

buffer: { slice: [Function: slice], byteLength: 0 },

length: 0,

byteOffset: 0,

byteLength: 0 }


Aucun commentaire:

Enregistrer un commentaire