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.buffer); f.close();
By using .buffer you're not actually allocating any more memory - the two arrays are sharing the same data.
.buffer
@Gordon started
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
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:
By using
.buffer
you're not actually allocating any more memory - the two arrays are sharing the same data.