npm install bytearray.js
bower install bytearray.js
ByteArray.js is an implementation of Actionscript 3's ByteArray, but then in pure Javascript. This library supports most of it's features from Actionscript 3. A small goal is to make Actionscript 3 developers switch to a newer platform by supporting a key library. The default length of the buffer is 4096 bytes, but if you want to use more, go ahead, you're a rebel.
ByteArray.js provides support for both AMF0 and AMF3. It can serialize and deserialize your data. The data gets shared with the ByteArray byte stream, allowing you to directly do stuff with it by just calling the constructor for ByteArray, how handy.
This library also supports IEEE 754 values in case you ever need to make something float.
ByteArray.js got you covered! If you want to compress some data, you can also use this library. The supported compression types are: DEFLATE, LZMA and ZLIB.
Now this isn't part of Actionscript 3's ByteArray, but it's still useful in case you ever need it. The supported types are: int32 and uint32.
This is the part where some hacky stuff comes in. We can actually read data from ByteArray's byte stream with DataView. Take a look in /Examples/test.js on how to use it.
There is a minifed part, but minified means that some functions are cut out, but don't worry! The minified version supports all of the mayor functions. You can find the minified version under the name ByteArrayHP.js
ByteArray.js has JSDOC. If you know what AMF is, you should know the documentation already, if you don't, you can find that by Adobe. In short terms: discover it's files and you'll discover the documentation, simple right?
I have included a very simple file that basically shows you what to do. You can find it all in /Examples/test.js. This includes AMF tests, as well as compression tests.
