MCPcopy Create free account
hub / github.com/p2r3/convert / decodeUTF32

Function decodeUTF32

src/handlers/textEncoding.ts:10–18  ·  view source on GitHub ↗
(bytes: Uint8Array, littleEndian: boolean)

Source from the content-addressed store, hash-verified

8}
9
10function decodeUTF32(bytes: Uint8Array, littleEndian: boolean) {
11 const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);
12 let out = "";
13 for (let i = 0; i + 4 <= dv.byteLength; i += 4) {
14 const cp = dv.getUint32(i, littleEndian);
15 out += String.fromCodePoint(cp);
16 }
17 return out;
18}
19
20function decodeUTF16(bytes: Uint8Array, littleEndian: boolean) {
21 const dv = new DataView(bytes.buffer, bytes.byteOffset, bytes.byteLength);

Callers 1

doConvertMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…