MCPcopy Index your code
hub / github.com/apache/tvm / StringToUint8Array

Function StringToUint8Array

web/src/support.ts:37–45  ·  view source on GitHub ↗
(str: string)

Source from the content-addressed store, hash-verified

35 * @returns The corresponding Uint8Array.
36 */
37export function StringToUint8Array(str: string): Uint8Array {
38 const arr: Uint8Array = new TextEncoder().encode(str);
39 const resArr = new Uint8Array(arr.length + 1);
40 for (let i = 0; i < arr.length; ++i) {
41 resArr[i] = arr[i];
42 }
43 resArr[arr.length] = 0;
44 return resArr;
45}
46
47/**
48 * Convert Uint8array to string.

Callers 4

onOpenMethod · 0.90
allocThenSetArgStringMethod · 0.90

Calls 1

encodeMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…