optimize Uint8Array2str function for large payloads
This commit is contained in:
parent
83d40d29ed
commit
a4190061d9
|
@ -274,9 +274,12 @@ export default {
|
||||||
throw new Error('Uint8Array2str: Data must be in the form of a Uint8Array');
|
throw new Error('Uint8Array2str: Data must be in the form of a Uint8Array');
|
||||||
}
|
}
|
||||||
|
|
||||||
var result = [];
|
var result = [],
|
||||||
for (var i = 0; i < bin.length; i++) {
|
bs = 16384,
|
||||||
result[i] = String.fromCharCode(bin[i]);
|
j = bin.length;
|
||||||
|
|
||||||
|
for (var i = 0; i < j; i += bs) {
|
||||||
|
result.push(String.fromCharCode.apply(String, bin.slice(i, i+bs < j ? i+bs : j)));
|
||||||
}
|
}
|
||||||
return result.join('');
|
return result.join('');
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue
Block a user