-
• #2
Do you know the length?
What you're doing is fine, but I'd be tempted to just read the whole thing (or at least big chunks) into memory and use views to read it directly:
var f = E.openFile("myTestF.idx","r"); var bytes = E.toUint8Array(f.read(16)); var floats = new Float32Array(bytes.bÂuffer); f.close();
By using
.buffer
you're not actually allocating any more memory - the two arrays are sharing the same data.
Is there a better way to read data from a file into Float32Array than this ?