See
Function.prototype.apply() - JavaScript | MDN[
^]:
Quote:
The apply() method calls a function with a given this value and arguments provided as an array.
That means that
String.fromCharCode
is called with so many arguments as there are items in the array. But there is a limitation for the maximum number of arguments that can be passed to a function (usually about 64k). You have hit this limit which is indicated by the error message.
Solution:
Use a loop to call
String.fromCharCode
for each array element or use a text decoder (e.g.
TextDecoder("utf-8").decode(arrayBuffer)
).