MCPcopy Create free account
hub / github.com/RtlZeroMemory/Rezi / loadImage

Function loadImage

packages/node/src/image.ts:34–49  ·  view source on GitHub ↗
(path: string)

Source from the content-addressed store, hash-verified

32}
33
34export function loadImage(path: string): Uint8Array {
35 if (path.length === 0) {
36 throw new TypeError("loadImage(path): path must be a non-empty string");
37 }
38 const resolvedPath = resolve(path);
39 const cached = IMAGE_CACHE.get(resolvedPath);
40 if (cached) {
41 IMAGE_CACHE.delete(resolvedPath);
42 IMAGE_CACHE.set(resolvedPath, cached);
43 return cached;
44 }
45 const bytes = new Uint8Array(readFileSync(resolvedPath));
46 IMAGE_CACHE.set(resolvedPath, bytes);
47 evictOverflowEntries();
48 return bytes;
49}

Callers 1

loadImage.test.tsFile · 0.85

Calls 5

resolveFunction · 0.85
evictOverflowEntriesFunction · 0.85
getMethod · 0.45
deleteMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected