MCPcopy
hub / github.com/vercel/next.js / fetchFontFile

Function fetchFontFile

packages/font/src/google/fetch-font-file.ts:9–24  ·  view source on GitHub ↗
(url: string, isDev: boolean)

Source from the content-addressed store, hash-verified

7 * If NEXT_FONT_GOOGLE_MOCKED_RESPONSES is set, we handle mock data logic.
8 */
9export async function fetchFontFile(url: string, isDev: boolean) {
10 if (process.env.NEXT_FONT_GOOGLE_MOCKED_RESPONSES) {
11 if (url.startsWith('/')) {
12 return fs.readFileSync(url)
13 }
14 return Buffer.from(url)
15 }
16
17 return await retry(async () => {
18 return fetchResource(
19 url,
20 isDev,
21 `Failed to fetch font file from \`${url}\`.`
22 )
23 }, 3)
24}

Callers 1

nextFontGoogleFontLoaderFunction · 0.90

Calls 5

retryFunction · 0.90
fetchResourceFunction · 0.90
startsWithMethod · 0.80
readFileSyncMethod · 0.80
fromMethod · 0.45

Tested by

no test coverage detected