The ActionScript ByteArray class, written in modern JavaScript.
$ npm install @seirdotexe/bytearray
Below you'll find an easy showcase of the library. You can also check out the tests for an extensive showcase on how to use the library.
import ByteArray, { Enums } from '@seirdotexe/bytearray';
const bytearr = new ByteArray();
bytearr.endian = Enums.Endian.LITTLE_ENDIAN;
bytearr.writeByte(25);
bytearr.writeShort(1600);
bytearr.writeBoolean(false);
bytearr.writeUTF('Test_Message');
bytearr.position = 0;
bytearr.readByte(); // 25
bytearr.readShort(); // 1600
bytearr.readBoolean(); // false
bytearr.readUTF(); // Test_Message