MCPcopy Create free account
hub / github.com/TeleBoxOrg/TeleBox_Plugins / getAssetBuffer

Function getAssetBuffer

eat/eat.ts:122–134  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

120}
121
122async function getAssetBuffer(url: string): Promise<Buffer> {
123 const absoluteUrl = resolveResourceUrl(url);
124 const cached = assetBufferCache.get(absoluteUrl);
125 if (cached) return cached;
126
127 const response = await axios.get(absoluteUrl, {
128 responseType: "arraybuffer",
129 });
130 const buf = Buffer.from(response.data);
131 assetBufferCache.set(absoluteUrl, buf);
132 trimAssetCache();
133 return buf;
134}
135
136async function iconMaskedFor(params: {
137 role: RoleConfig;

Callers 2

iconMaskedForFunction · 0.85
compositeWithEntryConfigFunction · 0.85

Calls 4

resolveResourceUrlFunction · 0.85
trimAssetCacheFunction · 0.85
getMethod · 0.45
setMethod · 0.45

Tested by

no test coverage detected