* Converts a 8-bit bytes array into a string * @param {!Uint8Array} bytes * @return {string}
(bytes)
| 3174 | * @return {string} |
| 3175 | */ |
| 3176 | function bytesToString(bytes) { |
| 3177 | // Intentionally avoids String.fromCharCode.apply so we don't suffer a |
| 3178 | // stack overflow. #10495, https://jsperf.com/bytesToString-2 |
| 3179 | const array = new Array(bytes.length); |
| 3180 | for (let i = 0; i < bytes.length; i++) { |
| 3181 | array[i] = String.fromCharCode(bytes[i]); |
| 3182 | } |
| 3183 | return array.join(''); |
| 3184 | } |
| 3185 | |
| 3186 | /** |
| 3187 | * Interpret a byte array as a UTF-8 string. |
no outgoing calls
no test coverage detected