MCPcopy Create free account
hub / github.com/observablehq/framework / image

Method image

src/client/stdlib/fileAttachment.js:69–79  ·  view source on GitHub ↗
(props)

Source from the content-addressed store, hash-verified

67 return this.dsv({...options, delimiter: "\t"});
68 }
69 async image(props) {
70 const url = await this.url();
71 return new Promise((resolve, reject) => {
72 const i = new Image();
73 if (new URL(url, document.baseURI).origin !== new URL(location).origin) i.crossOrigin = "anonymous";
74 Object.assign(i, props);
75 i.onload = () => resolve(i);
76 i.onerror = () => reject(new Error(`Unable to load file: ${this.name}`));
77 i.src = url;
78 });
79 }
80 async arrow() {
81 const [Arrow, response] = await Promise.all([import("npm:apache-arrow"), remote_fetch(this)]);
82 return Arrow.tableFromIPC(response);

Callers

nothing calls this directly

Calls 3

rejectFunction · 0.85
resolveFunction · 0.50
urlMethod · 0.45

Tested by

no test coverage detected