You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/*The main idea is to split the buffer into a smaller buffers,call to_string on each one of them, and concatenate the results*/vartoStringChunkSize=32767;functionto_string(bytes){if(typeofTextDecoder==="function"){returnnewTextDecoder("utf-8",{fatal: true}).decode(bytes);}varnumChunks=Math.ceil(bytes.length/toStringChunkSize);if(numChunks>1){vartotalString='';for(vari=0;i<numChunks;i++){totalString+=to_string(Array.prototype.slice.call(bytes,i*toStringChunkSize,(i+1)*toStringChunkSize));}returntotalString;}try{returndecodeURIComponent(escape(String.fromCharCode.apply(null,bytes)));}catch(_){thrownewTypeError("The encoded data was not valid.");}}
PS: Sorry for not submitting this as a PR.
The text was updated successfully, but these errors were encountered:
It seems that, despite not being defined the ECMAScript spec, JavaScript runtimes tend to impose a limit on how many arguments a function can receive. And since the current
to_string
implementation in the libsodium wrapper uses aFunction.call
paradigm, you tend to hit that wall at some point.Here is a fix (among other possible ones) :
PS: Sorry for not submitting this as a PR.
The text was updated successfully, but these errors were encountered: