MCPcopy Index your code
hub / github.com/atomicdata-dev/atomic-data-browser / fetchResource

Method fetchResource

lib/src/store.ts:91–108  ·  view source on GitHub ↗

Fetches a resource by URL and adds it to the store.

(
    /** The resource URL to be fetched */
    subject: string,
    opts: {
      /**
       * Fetch it from the `/path` endpoint of your server URL. This effectively
       * is a proxy / cache.
       */
      fromProxy?: boolean;
    } = {},
  )

Source from the content-addressed store, hash-verified

89
90 /** Fetches a resource by URL and adds it to the store. */
91 async fetchResource(
92 /** The resource URL to be fetched */
93 subject: string,
94 opts: {
95 /**
96 * Fetch it from the `/path` endpoint of your server URL. This effectively
97 * is a proxy / cache.
98 */
99 fromProxy?: boolean;
100 } = {},
101 ): Promise<Resource> {
102 const fetched = await fetchResource(
103 subject,
104 this,
105 opts.fromProxy && this.getServerUrl(),
106 );
107 return fetched;
108 }
109
110 getAllSubjects(): string[] {
111 return Array.from(this.resources.keys());

Callers 8

getResourceLoadingMethod · 0.95
getResourceAsyncMethod · 0.95
setAgentMethod · 0.95
App.tsxFile · 0.80
ResourceContextMenuFunction · 0.80
CollectionFunction · 0.80
RedirectPageFunction · 0.80
ErrorPageFunction · 0.80

Calls 2

getServerUrlMethod · 0.95
fetchResourceFunction · 0.90

Tested by

no test coverage detected