Skip to content Skip to sidebar Skip to footer

Does Javascript Support A Bytearray Class In The Browser?

The ByteArray class provides methods and properties to optimize reading, writing, and working with binary data. How to use byte arrays tutorial. I'm looking for a very similar API

Solution 1:

Modern browsers support Uint8Array, one of JavaScript's TypedArray classes.

var data = newUint8Array(8);
var data = newUint8Array([0x10, 0x12]);

It does not have built-in methods for encoding/decoding Unicode strings. See Converting between strings and ArrayBuffers for examples of how to do that.

Solution 2:

The answer is yes, here are the relevant docs since you just wanted this...

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Typed_arrays

The linked docs for each type in the above docs show the methods available on each type. IE: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int8Array

Post a Comment for "Does Javascript Support A Bytearray Class In The Browser?"