JavaScript represents a long array of bytes as an ArrayBuffer
You can get a typed view of this buffer that is very efficient to interact with.
// create an array of 8 bytes
let bytes = new ArrayBuffer(8);
// view those 8 bytes as 8-bit unsigned integers
let u8_bytes = new Uint8Array(bytes);
// modify the array buffer
u8_bytes[0] = 16; // 00010000
u8_bytes[1] = 1; // 00000001
// re-interpret the u8_bytes's array buffer as
// little endian 32-bit signed integers
let i32_bytes = new Int32Array(u8_bytes.buffer);
console.log(i32_bytes[0]);
///272 or 00010000000000010000000000000000