MCPcopy Create free account
hub / github.com/Dstack-TEE/dstack / hexToBytes

Function hexToBytes

vmm/ui/src/composables/useVmManager.ts:327–339  ·  view source on GitHub ↗
(hex: string)

Source from the content-addressed store, hash-verified

325 }
326
327 function hexToBytes(hex: string) {
328 if (!hex) {
329 return new Uint8Array();
330 }
331 const normalized = hex.startsWith('0x') ? hex.slice(2) : hex;
332 const length = Math.floor(normalized.length / 2);
333 const result = new Uint8Array(length);
334 for (let i = 0; i < length; i += 1) {
335 const byte = normalized.slice(i * 2, i * 2 + 2);
336 result[i] = Number.parseInt(byte, 16);
337 }
338 return result;
339 }
340
341 const clonePortMappings = (ports: VmmTypes.IPortMapping[] = []): PortFormEntry[] =>
342 ports.map((port) => ({

Callers 2

encryptEnvFunction · 0.70
updateVMFunction · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected