I little confused here. Do ArrayBuffer allocate a new memory region for it? If so, what would be the safe maximum Blob size to put on it?
The maximum buffer size for input/output is 32767 bytes.
Uint8Array – treats each byte in ArrayBuffer as a separate number, with possible values from 0 to 255 (a byte is 8-bit, so it can hold only that much). Such value is called a “8-bit unsigned integer”. Uint16Array – treats every 2 bytes as an integer, with possible values from 0 to 65535.
The ArrayBuffer object is used to represent a generic, fixed-length raw binary data buffer. It is an array of bytes, often referred to in other languages as a "byte array".
The Uint8Array. from() method is used to create a new Uint8Array from an array-like or iterable object. So when you want to convert an arrayLike or iterable object then you can be used this function by passing the object as a parameter to this function along with map function and value used for map function if needed.
That only depends on your system and there doesn't seems to be a limit.
According to the specification :
If the requested number of bytes could not be allocated an exception is raised.
what would be the safe maximum Blob size to put on it
There does not seem to be a hard limit, just whatever restrictions your platform imposes.
However, if one uses some sort of indexed access, indexes shouldn't be greater than Number.MAX_SAFE_INTEGER, because interesting bugs would happen otherwise.
Luckily, 2^53-1 bytes is around 8 petabytes so it shuoldn't be a concern unless you are doing something really weird.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With