MCPcopy Create free account
hub / github.com/Botloader/botloader / downloadTypeDecls

Function downloadTypeDecls

botloader-vscode/src/extension.ts:298–319  ·  view source on GitHub ↗
(context: vscode.ExtensionContext)

Source from the content-addressed store, hash-verified

296}
297
298async function downloadTypeDecls(context: vscode.ExtensionContext): Promise<void> {
299 const config = vscode.workspace.getConfiguration("botloader");
300 const webHostBase: string = config.get("webHost")!;
301 const webHttps: boolean = config.get("webHttpsEnabled")!;
302 const httpHostBase = webHttps ? "https://" + webHostBase : "http://" + webHostBase;
303 const downloadPath = vscode.Uri.joinPath(vscode.Uri.parse(httpHostBase, true), "typings.tar")
304 let resp = await fetch(downloadPath.toString());
305
306 const outPath = vscode.Uri.joinPath(context.globalStorageUri, "/typings");
307 console.log("downloading types to: ", outPath.fsPath, resp.status);
308
309 let stream = tar.extract({
310 cwd: outPath.fsPath,
311 strip: 1,
312 });
313
314 let body = resp.body?.pipe(stream);
315
316 stream.on("end", () => {
317 vscode.commands.executeCommand("typescript.reloadProjects");
318 });
319}

Callers 1

updateTypeDeclsFunction · 0.70

Calls 4

toStringMethod · 0.80
logMethod · 0.80
getMethod · 0.45
onMethod · 0.45

Tested by

no test coverage detected