DataView

A DataView reads and writes numbers of any size at any byte offset, as binary file formats and protocols require. new DataView(buffer, byteOffset?, byteLength?) offers get/set pairs from getInt8() through getUint32(), getFloat16(), getFloat32(), getFloat64() and getBigInt64()/getBigUint64(), each taking the offset first and an optional littleEndian flag last. The default is big-endian (network byte order), whatever the CPU.

Reading a PNG header, whose integers are big-endianJavaScriptLive
// First 24 bytes of a PNG: signature, IHDR chunk length and type, width, height
const png = Uint8Array.fromHex('89504e470d0a1a0a0000000d49484452000002d000000190');
const dv = new DataView(png.buffer);
console.log(dv.getUint32(16), dv.getUint32(20), dv.getUint32(16, true));
dv.setFloat32(0, Math.PI, true);                  // write little-endian
console.log(dv.getFloat32(0, true), png.subarray(0, 4));

A missing or wrong endianness flag still returns a number, just the wrong one (3489792000 above). When wrapping a view that does not start at byte 0, such as a pooled Node.js 2,131 Buffer, pass its byteOffset and byteLength.