MCPcopy Index your code
hub / github.com/processing/p5.js / loadAvatar

Function loadAvatar

utils/contributors-png.js:19–29  ·  view source on GitHub ↗
(url)

Source from the content-addressed store, hash-verified

17const ctx = canvas.getContext('2d');
18
19async function loadAvatar(url) {
20 try {
21 const res = await fetch(url);
22 if (!res.ok) throw new Error(`HTTP ${res.status}`);
23
24 const buffer = Buffer.from(await res.arrayBuffer());
25 return await loadImage(buffer);
26 } catch (err) {
27 return null;
28 }
29}
30
31(async () => {
32 for (let i = 0; i < contributors.length; i++) {

Callers 1

Calls

no outgoing calls

Tested by

no test coverage detected