fetch() — astro Function Reference
Architecture documentation for the fetch() function in cached-font-fetcher.ts from the astro codebase.
Entity Profile
Dependency Diagram
graph TD 1433ecdf_5efc_6b47_6da2_e0c4bcebae21["fetch()"] 767f384c_0dbf_0041_0eb2_69933f4c7602["CachedFontFetcher"] 1433ecdf_5efc_6b47_6da2_e0c4bcebae21 -->|defined in| 767f384c_0dbf_0041_0eb2_69933f4c7602 style 1433ecdf_5efc_6b47_6da2_e0c4bcebae21 fill:#6366f1,stroke:#818cf8,color:#fff
Relationship Graph
Source Code
packages/astro/src/assets/fonts/infra/cached-font-fetcher.ts lines 35–56
async fetch({ id, url, init }: FontFileData): Promise<Buffer> {
return await this.#cache(this.#storage, id, async () => {
try {
if (isAbsolute(url)) {
return await this.#readFile(url);
}
const response = await this.#fetch(url, init ?? undefined);
if (!response.ok) {
throw new Error(`Response was not successful, received status code ${response.status}`);
}
return Buffer.from(await response.arrayBuffer());
} catch (cause) {
throw new AstroError(
{
...AstroErrorData.CannotFetchFontFile,
message: AstroErrorData.CannotFetchFontFile.message(url),
},
{ cause },
);
}
});
}
Domain
Subdomains
Source
Frequently Asked Questions
What does fetch() do?
fetch() is a function in the astro codebase, defined in packages/astro/src/assets/fonts/infra/cached-font-fetcher.ts.
Where is fetch() defined?
fetch() is defined in packages/astro/src/assets/fonts/infra/cached-font-fetcher.ts at line 35.
Analyze Your Own Codebase
Get architecture documentation, dependency graphs, and domain analysis for your codebase in minutes.
Try Supermodel Free