MCPcopy Index your code
hub / github.com/NativeScript/SimDeck / fetchSimulatorBlob

Function fetchSimulatorBlob

packages/client/src/api/controls.ts:122–145  ·  view source on GitHub ↗
(
  path: string,
  options: RequestInit = {},
)

Source from the content-addressed store, hash-verified

120}
121
122async function fetchSimulatorBlob(
123 path: string,
124 options: RequestInit = {},
125): Promise<Blob> {
126 const { headers, ...rest } = options;
127 const response = await fetch(apiUrl(path), {
128 ...rest,
129 headers: apiHeaders(headers),
130 });
131 if (!response.ok) {
132 const contentType = response.headers.get("content-type") ?? "";
133 if (contentType.includes("application/json")) {
134 const body = (await response.json()) as { error?: string };
135 throw new Error(
136 body.error ?? `Request failed with status ${response.status}`,
137 );
138 }
139 throw new Error(
140 (await response.text()) ||
141 `Request failed with status ${response.status}`,
142 );
143 }
144 return response.blob();
145}
146
147export function captureSimulatorScreenshot(
148 udid: string,

Callers 3

recordSimulatorScreenFunction · 0.85

Calls 7

apiUrlFunction · 0.90
apiHeadersFunction · 0.90
fetchFunction · 0.85
jsonMethod · 0.80
blobMethod · 0.80
getMethod · 0.65
textMethod · 0.65

Tested by

no test coverage detected