MCPcopy
hub / github.com/google/brotli / bytesToString

Function bytesToString

js/decode_synth_test.js:14–25  ·  view source on GitHub ↗

* NB: Use intermediate chunks to avoid "Maximum call stack size exceeded". * * @param {!Int8Array} bytes * @return {string}

(bytes)

Source from the content-addressed store, hash-verified

12 * @return {string}
13 */
14function bytesToString(bytes) {
15 const kChunkSize = 4096;
16 if (bytes.length <= kChunkSize) {
17 return String.fromCharCode.apply(null, new Uint8Array(bytes));
18 }
19 const chunks = [];
20 for (let start = 0; start < bytes.length; start += kChunkSize) {
21 const end = Math.min(start + 4096, bytes.length);
22 chunks.push(bytesToString(bytes.slice(start, end)));
23 }
24 return chunks.join('');
25}
26
27/**
28 * NB: String.prototype.repeat causes "Maximum call stack size exceeded".

Callers 1

checkSynthFunction · 0.70

Calls 2

minMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…