MCPcopy Create free account
hub / github.com/browserbase/stagehand / run

Method run

packages/cli/src/commands/cloud/fetch.ts:61–93  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

59 };
60
61 async run(): Promise<void> {
62 const { args, flags } = await this.parse(Fetch);
63 const format = flags.format as FetchFormat;
64 const schema = resolveFetchSchema(format, flags.schema);
65 const client = createBrowserbaseClient(toApiOptions(flags));
66 const result = await withBrowserbaseApi(
67 "fetch",
68 async () =>
69 await client.fetchAPI.create({
70 url: args.url,
71 allowInsecureSsl: flags["allow-insecure-ssl"],
72 allowRedirects: flags["allow-redirects"],
73 format,
74 proxies: flags.proxies,
75 schema,
76 }),
77 );
78
79 if (flags.output) {
80 const contents = stringifyFetchContent(result.content);
81 await writeOutputFile(flags.output, contents);
82 outputJson({
83 ok: true,
84 outputPath: flags.output,
85 contentType: result.contentType,
86 statusCode: result.statusCode,
87 sizeBytes: Buffer.byteLength(contents, "utf8"),
88 });
89 return;
90 }
91
92 outputJson(result);
93 }
94}
95
96function resolveFetchSchema(

Callers

nothing calls this directly

Calls 8

resolveFetchSchemaFunction · 0.85
createBrowserbaseClientFunction · 0.85
toApiOptionsFunction · 0.85
withBrowserbaseApiFunction · 0.85
stringifyFetchContentFunction · 0.85
writeOutputFileFunction · 0.85
outputJsonFunction · 0.85
createMethod · 0.45

Tested by

no test coverage detected