MCPcopy Create free account
hub / github.com/fontsource/fontsource / fetchPackageTarball

Function fetchPackageTarball

api/shared/upstream.ts:163–176  ·  view source on GitHub ↗
(
	id: string,
	version: string,
	isVariable = false,
)

Source from the content-addressed store, hash-verified

161};
162
163export const fetchPackageTarball = async (
164 id: string,
165 version: string,
166 isVariable = false,
167): Promise<ReadableStream<Uint8Array<ArrayBuffer>>> => {
168 const url = `${UPSTREAM_URLS.npmRegistry}/${packageName(id, isVariable)}/-/${id}-${version}.tgz`;
169 const response = await fetchWithCache(url);
170
171 if (!response.body) {
172 throw new Error(`Upstream response body was empty: ${url}`);
173 }
174
175 return response.body;
176};
177
178export const fetchPackageAssetBytes = async (
179 id: string,

Callers 2

readPackageArchiveFunction · 0.90
upstream.test.tsFile · 0.90

Calls 2

packageNameFunction · 0.85
fetchWithCacheFunction · 0.85

Tested by

no test coverage detected